Skip to content

Skip version pinning for renamed starters when dependency-management plugin is present#951

Merged
timtebeek merged 4 commits intomainfrom
skip-version-pinning-managed-deps
Mar 2, 2026
Merged

Skip version pinning for renamed starters when dependency-management plugin is present#951
timtebeek merged 4 commits intomainfrom
skip-version-pinning-managed-deps

Conversation

@Jenson3210
Copy link
Contributor

@Jenson3210 Jenson3210 commented Mar 2, 2026

Summary

  • Add RenameDeprecatedStartersManagedVersions declarative recipe with ModuleHasPlugin precondition
  • When io.spring.dependency-management plugin is present, renamed starters get no explicit version
  • Existing ChangeDependency calls with newVersion: 4.0.x serve as fallback for modules without the plugin

Problem

When the Spring Boot 4.0 migration recipe renames deprecated starters (e.g., spring-boot-starter-webspring-boot-starter-webmvc), it pins explicit versions like 4.0.3 even when the io.spring.dependency-management plugin manages versions via BOM. The dependency should remain version-less since the BOM controls the version.

Solution

A new wrapper declarative recipe RenameDeprecatedStartersManagedVersions runs first with a ModuleHasPlugin(pluginId: io.spring.dependency-management) precondition. It performs the same starter renames but without specifying newVersion. The existing ChangeDependency calls (with newVersion: 4.0.x) follow as fallback — on modules where the managed variant already renamed the artifact, the oldArtifactId no longer matches, so they are no-ops.

Test plan

  • New test: renameStarterWithoutVersionWhenDepMgmtPluginPresent — verifies starters are renamed without version when plugin is present

  • New test: renameStarterWithVersionWhenDepMgmtPluginAbsent — verifies starters get explicit version when plugin is absent

  • Existing boot4 tests pass

  • LoadRecipeTest passes (YAML validation)

  • Fixes moderneinc/customer-requests#1939

…plugin is present

When the io.spring.dependency-management plugin manages versions via BOM,
the Spring Boot 4.0 migration recipe should not pin explicit versions on
renamed starters. Previously, ChangeDependency calls for renamed starters
(e.g., spring-boot-starter-web → spring-boot-starter-webmvc) always
specified newVersion: 4.0.x, causing version pinning even when the BOM
manages the version.

Add a RenameDeprecatedStartersManagedVersions declarative recipe with a
ModuleHasPlugin precondition that renames starters without adding versions.
The existing ChangeDependency calls with newVersion serve as fallback for
modules without the plugin (they are no-ops when the managed variant
already renamed the artifact).

Fixes moderneinc/customer-requests#1939
Run tests through the full migration recipe instead of testing individual
sub-recipes in isolation. This proves the end-to-end behavior: starters
are renamed without version when the dependency-management plugin is
present, and with version when it is absent.
@Jenson3210 Jenson3210 requested a review from timtebeek March 2, 2026 14:17
@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Mar 2, 2026
@timtebeek timtebeek merged commit 89805e8 into main Mar 2, 2026
1 check passed
@timtebeek timtebeek deleted the skip-version-pinning-managed-deps branch March 2, 2026 16:06
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants