Search code examples
openrewrite

Migrate to Spring Boot 3.x recipe not working if project parent artifactId is spring-boot-dependencies


Trying to upgrade my project from spring-boot 3.1.x to 3.2.x, Spring Rewrite recipe does not upgrade my project spring version and properties which having artifact spring-boot-dependencies as parent pom

<modelVersion>4.0.0</modelVersion>
  <groupId>com.it.testapi</groupId>
  <artifactId>testapi-build</artifactId>
  <version>${revision}</version>
  <packaging>pom</packaging>
  <name>com.it.testapi.build</name>
  <description>Parent pom for Bill of materials , builds all the myapi boms as sub
    modules
  </description>
  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <version>3.1.6</version>
    <relativePath/>
  </parent>
  <properties>
    <embedBuildProfileDependencies>true</embedBuildProfileDependencies>
    <spring-boot-version>3.1.6</spring-boot-version>
    <jacoco-maven-plugin.version>0.8.10</jacoco-maven-plugin.version>
  </properties>
  <modules>
    <module>testapi-dependencies</module>
    <module>testapi-starters</module>
    <module>testapi-parent</module>
    <module>testapi-logger-parent</module>
    <module>testapi-config</module>
    <module>testapi-security</module>

Is org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_2 recipes only consider if parent is spring-boot-starter ?


Solution

  • We hadn't yet covered cases where folks use spring-boot-dependencies as a parent, but I suppose we could add that fairly easily. We'd mostly assumed folks would use spring-boot-starter-parent as their parent. What's the reason you're not using that one?

    To add support for upgrading spring-boot-dependencies as parent, we'd have to copy these lines: https://github.com/openrewrite/rewrite-spring/blob/8f1f7b94b81df08f62b7c558dbff44b1f486f65d/src/main/resources/META-INF/rewrite/spring-boot-32.yml#L35-L38

    Feel free to open a pull request or issue with that change against
    https://github.com/openrewrite/rewrite-spring/