rewrite-spring icon indicating copy to clipboard operation
rewrite-spring copied to clipboard

spring-boot-22 and -23 recipes are overwriting version placeholder with version

Open FieteO opened this issue 2 years ago • 0 comments

What version of OpenRewrite are you using?

I am using

  • Maven/Gradle plugin v5.18.0
  • rewrite-spring v5.1.7

How are you running OpenRewrite?

I am using the Maven command line invokation

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.spring.boot2.UpgradeSpringBoot_2_3

What is the smallest, simplest way to reproduce the problem?

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <properties>
    <spring.boot.version>2.2.13.RELEASE</spring.boot.version>
    <spring.jms.version>5.2.25.RELEASE</spring.jms.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring.boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jms</artifactId>
        <version>${spring.jms.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>

What did you expect to see?

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <properties>
    <spring.boot.version>2.3.12.RELEASE</spring.boot.version>
    <spring.jms.version>5.2.25.RELEASE</spring.jms.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring.boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jms</artifactId>
        <version>${spring.jms.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>

What did you see instead?

The placeholder ${spring.jms.version} is replaced with the hard coded version. Note that this is not happening for other placeholders like ${spring.boot.version} in the file.

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <properties>
    <spring.boot.version>2.2.13.RELEASE</spring.boot.version>
    <spring.jms.version>5.2.25.RELEASE</spring.jms.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring.boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jms</artifactId>
        <version>5.2.25.RELEASE</version>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>

What is the full stack trace of any errors you encountered?

No errors.

Are you interested in contributing a fix to OpenRewrite?

I currently lack the time to do so unfortunately.

FieteO avatar Jan 10 '24 14:01 FieteO