Add mvnup SourceStrategy for migrating to <source> elements - #12355
Merged
Merged
Conversation
Adds a new mvnup upgrade strategy that migrates legacy source configuration to Maven 4.1.0+ <source> elements. Handles four migration phases: - Compiler properties (maven.compiler.release, source/target) to <source><targetVersion> - Compiler plugin configuration (<release>, <source>/<target>) to <source><targetVersion> - Custom source/test directories to <source><directory> - Resource/testResource sections to <source> with lang=resources Applies when --model-version is 4.1.0+ or --all is set. Runs at @priority(20), after all other strategies. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 tasks
- Check groupId in findCompilerPlugin (not just artifactId) - Clean up compiler plugin config when properties already provide targetVersion (previously left stale release/source/target elements) - Clean up empty pluginManagement after plugin removal - Clean up empty build element after all children removed - Add test for pluginManagement compiler plugin migration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address review feedback from desruisseaux: extract shared logic from copyIncludesExcludes into a static copyPatternList method. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Reuse existing main/java <source> element when adding targetVersion instead of always creating a new one (avoids duplicate source elements) - Only remove compiler plugin config (release/source/target) when values match the migrated property value (preserves intentional overrides) - Add tests for both edge cases Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SourceStrategy(@Priority(20)) to migrate legacy source configuration to Maven 4.1.0+<source>elementsmaven.compiler.release,maven.compiler.source/target) →<source><targetVersion><release>,<source>/<target>in maven-compiler-plugin) →<source><targetVersion><sourceDirectory>/<testSourceDirectory>) →<source><directory><resources>/<testResources>) →<source>with<lang>resources</lang>, preserving filtering, includes/excludes, and targetPath--model-versionis 4.1.0+ or--allis set<source>entries<properties>,<plugins>,<configuration>) are removed after migrationTest plan
mvnup --model-version 4.1.0, verify output🤖 Generated with Claude Code