On 22 Sep 2014, at 23:34, animator <l.gadaw...@gmail.com> wrote: > The main problem from the topic finally I managed to resolve. The problem was > wrong configuration in test-polyglot-project, the groupId of declared plugin > in pom was wrong and when the goal was executed it was used plugin from > local repository and any configuration from pom was omitted.. Anyway thanks > for advices! > > Second problem with injecting plexus components still exists.. I added no > arg constructor and @Requirement annotation but still I get the same > exceptions.
Hi, I took a quick look at your project, to get Maven to see ClojureExecutorImpl as a Plexus component you need to generate some extra XML metadata for it (this is separate to the Maven plugin metadata generation): <plugin> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-component-metadata</artifactId> <version>1.5.5</version> <executions> <execution> <goals> <goal>generate-metadata</goal> </goals> </execution> </executions> </plugin> This writes a file to "target/classes/META-INF/plexus/components.xml” which Plexus* will read to discover the components. Maven configures Plexus to only use index files, rather than full classpath scanning, so without this metadata the component won’t be visible. Note that if you only plan to target Maven 3.1.x and above then you can use the more modern JSR330 annotations as explained in http://maven.apache.org/maven-jsr330.html and http://wiki.eclipse.org/Sisu/PlexusMigration - but for maximum Maven compatibility its best to stick with Plexus annotations for now (at least wrt re-usable components, Maven mojos should use the mojo-specific annotations). Secondly, ClojureExecutorImpl should inject the Plexus logger (org.codehaus.plexus.logging.Logger) because the Maven logger (org.apache.maven.plugin.logging.Log) is a special component only visible to mojos and is not available for Plexus components - underneath it logs to the same place, just gets exposed as a different API according to the injection context. The mojo specific injection is handled in a layer built on top of Plexus. BTW if ClojureExecutorImpl is not expected to have injected setters/fields (apart from logging), or you plan to only create instances using new, then making it a Plexus component is overkill. Looking at other maven plugins they typically either have non-injected components that they assemble themselves, or they use simple Plexus components and pass any Maven-specific context (that’s not visible to the Plexus context) in as method parameters. Anyway, with these two changes I was able to get the plugin working in the test project, so hopefully this explanation helps. * actually the work is being done by Sisu’s Plexus adapter, which provides Plexus API+semantics on top of Guice > Thanks for answers. > > -- > View this message in context: > http://maven.40175.n5.nabble.com/Problem-while-getting-injected-parameters-from-plugin-configuration-tp5805894p5806136.html > Sent from the Maven Developers mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org > For additional commands, e-mail: dev-h...@maven.apache.org