[MPLUGIN-441] Support for the new maven4 api#117
Conversation
05804d9 to
bc87d15
Compare
...java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotationsScanner.java
Show resolved
Hide resolved
931f8e6 to
4a5998a
Compare
maven-plugin-tools-generators/src/main/resources/help-class-source.vm
Outdated
Show resolved
Hide resolved
939348f to
07a5f84
Compare
|
@kwin @slawekjaranowski I've rebased, cleaned up and added an IT. The base maven version has been reverted to 3.2.5 so that the plugin remains fully compatible with 3.x. |
| mavenComponents.put( "org.apache.maven.api.Session", "${session}" ); | ||
| mavenComponents.put( "org.apache.maven.api.Project", "${project}" ); | ||
| mavenComponents.put( "org.apache.maven.api.MojoExecution", "${mojoExecution}" ); | ||
| // TODO: apiv4: add PluginDescriptor to the api ? | ||
| //mavenComponents.put( "org.apache.maven.api.descriptor.PluginDescriptor", "${plugin}" ); | ||
| mavenComponents.put( "org.apache.maven.api.settings.Settings", "${settings}" ); |
There was a problem hiding this comment.
I'm not sure about it ...
There was a problem hiding this comment.
Yeah, I was wondering about that as well. When I added the junit test, I copy/pasted an existing one and made sure it was working correcectly.
However, this is tied to maven itself and the way those parameters/components are injected.
From an API pov, using @Parameter( property = "${session}" ) Session session is not really intuitive, whereas @Component Session session looks simplier.
There was a problem hiding this comment.
As I remember @Component Session session is translated to @Parameter( property = "${session}" ) - to check if still needed
There was a problem hiding this comment.
Yes, and the map is here to do that. So if I remove the population of the mavenComponents with objects from the v4 api, this won't work anymore. The IT actually tests that.
There was a problem hiding this comment.
Also, I don't think the use of @Parameter or @Component should be dictated by the implementation. For example, the maven session is available as both a parameter injected by the plugin manager and a sisu bean inside the @SessionScope. Also @Component relates to the sisu components, but this does not have to be made explicit.
I would personally favor the @Component approach for everything that does not come from the configuration.
|
@slawekjaranowski are you ok with the current PR ? |
|
one for build log ... |
|
Trying: |
|
hangs forever, stack: |
Do we need the plugin to actually run ? |
I've removed the warning. |
This looks like a bug in https://github.com/apache/maven/blob/master/maven-core/src/main/java/org/apache/maven/internal/impl/PropertiesAsMap.java I've raised https://issues.apache.org/jira/browse/MNG-7597 with maven#872. |
Yes - iterator next method always return the same element 😄 |
slawekjaranowski
left a comment
There was a problem hiding this comment.
As plugin under test is only used for generating descriptor - it is ok for me.
|
Resolve #754 |
JIRA issue: https://issues.apache.org/jira/browse/MPLUGIN-441
This PR includes the following:
The plugin still supports maven 3 plugins so is compatible with all the existing plugins.
The new support is provided by the annotation scanner which now supports the new package
org.apache.maven.api.pluginin addition to the old one. The main difference is that if the new package is detected, a flag will be set on the mojo descriptor so that maven can know that the mojo is a v4 mojo and behave accordingly.