slachiewicz opened a new issue, #1230:
URL: https://github.com/apache/maven-plugin-tools/issues/1230

   ### Affected version
   
   4.0.0-beta-3; the code is unchanged on master
   
   ### Bug description
   
   The annotation scanner collects `@Resolution` as a field annotation 
([MojoAnnotationsScanner.java:56](https://github.com/apache/maven-plugin-tools/blob/master/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotationsScanner.java#L56)),
 but nothing turns it into descriptor content, so `plugin.xml` gets no 
`<resolutions>` element. Maven core injects `@Resolution` fields only from that 
element 
([DefaultMavenPluginManager.java:616](https://github.com/apache/maven/blob/master/impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java#L616)),
 so the field stays `null` and nothing reports an error.
   
   Reproducer, built with maven-plugin-plugin 4.0.0-beta-3 and run with Maven 
4.0.0-rc-7 on a project with one compile dependency; it prints `paths=null`:
   
   ```java
   @Mojo(name = "run")
   public class ReproMojo implements org.apache.maven.api.plugin.Mojo {
       @Resolution(pathScope = "main-compile")
       List<Path> paths;
   
       public void execute() {
           System.out.println("paths=" + paths);
       }
   }
   ```
   
   Expected: one `<resolution>` per annotated field, with `field`, `pathScope` 
and `requestType` as defined by the `resolutions` element in 
[plugin.mdo](https://github.com/apache/maven/blob/master/api/maven-api-plugin/src/main/mdo/plugin.mdo#L399).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to