You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "slachiewicz (via GitHub)" <gi...@apache.org> on 2026/10/01 18:25:05 UTC

[I] `@Resolution` fields stay null: `plugin.xml` gets no `` [maven-plugin-tools]

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: issues-unsubscribe@maven.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] `@Resolution` fields stay null: `plugin.xml` gets no `` [maven-plugin-tools]

Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on issue #1230:
URL: https://github.com/apache/maven-plugin-tools/issues/1230#issuecomment-5965658965

   @slachiewicz I reproduced this with Maven 4.0.0-rc-7 and prepared a fix #1234. Please let me know if you have any feedback.


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org