-
Notifications
You must be signed in to change notification settings - Fork 68
Add support for Maven 4 PluginDescriptor.getRequiredJavaVersion() method #401
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
Conversation
This commit enhances the PluginDescriptorHelper class to support the getRequiredJavaVersion() and setRequiredJavaVersion() methods directly on the PluginDescriptor class in Maven 4. The implementation: 1. Uses reflection to check if the methods exist in the current Maven version 2. Tries to use the direct methods first if available (Maven 4) 3. Falls back to the existing wrapper approach if needed (Maven 3) This approach ensures backward compatibility while taking advantage of the new methods in Maven 4.
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.
How it will be used?
Why not direct use class from Maven core ... such master branch will be dedicated to Maven 4?
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.
We could, but I still think being able to build a maximum of projects targeting Maven 3 with Maven 4 is a good idea. We do want maximum compatibility when possible.
Also, if we target Maven 4, we should move to the new API, but that's more work imho.
So I'd rather to a micro release, and then start migrating this plugin to target Maven 4.
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.
so should we do it in branch: maven-plugin-tools-3.x ?
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.
so should we do it in branch: maven-plugin-tools-3.x ?
Yes, I suppose. Not sure we need to do it now, unless someone wants to start the migration asap though.
|
There must be a missing file in this commit, as the helper class is not used at all. |
Description
This PR enhances the
PluginDescriptorHelperclass to support thegetRequiredJavaVersion()andsetRequiredJavaVersion()methods directly on thePluginDescriptorclass in Maven 4.Implementation Details
The implementation:
This approach ensures backward compatibility while taking advantage of the new methods in Maven 4.
Changes
getRequiredJavaVersion()method to try the direct method firstsetRequiredJavaVersion()method following the same patternPull Request opened by Augment Code with guidance from the PR author