-
Notifications
You must be signed in to change notification settings - Fork 465
Upgrade annotation processor versions in Maven when using UpgradeDependencyVersion
#5936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…sion for Maven similarly to how Gradle does it.
versionComparator, ctx); | ||
} | ||
|
||
public boolean isAnnotationProcessorPathTag(String groupId, String artifactId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deliberately did not add this to the MavenVisitor like the other methods, as i feel these pollute the MavenVisitor. We can add helper methods there for every kind of tag, but if there is no reuse needed, I feel this is not "big" enough to be part of the MavenVisitor to avoid ending up with a whole lot of different helper methods.
I did reuse isTag
, making it protected accessible.
…sion for Maven similarly to how Gradle does it.
UpgradeDependencyVersion
…sions' into upgrade-annotation-processor-versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved from my side; let's get a final check just before we emrge.
Summary
This PR extends Maven's
UpgradeDependencyVersion
recipe to automatically upgrade annotation processor versions in Maven's<annotationProcessorPaths>
configuration, bringing Maven's behavior in line with how Gradle already handles annotation processor upgrades.Problem
Previously, when using
UpgradeDependencyVersion
to upgrade dependencies like MapStruct, the recipe would upgrade:<dependencies>
<plugin><dependencies>
However, it would not upgrade Maven annotation processors defined in:
This inconsistency meant that users had to manually update annotation processor versions in Maven projects, even when using automated dependency upgrade recipes.
Solution
This change treats Maven's
<annotationProcessorPaths><path>
elements similarly to plugin dependencies, ensuring they are upgraded alongside regular dependencies. The implementation:ANNOTATION_PROCESSORS_PATH_MATCHER
upgradePluginDependency
toupgradeTag
) for both plugin dependencies and annotation processor pathsTesting
Added comprehensive tests demonstrating:
Impact
This ensures consistent dependency management across build systems, eliminating the need for manual intervention when upgrading libraries that include annotation processors (like MapStruct, Lombok, etc.).
References