maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart McCulloch <mccu...@gmail.com>
Subject Re: Possible PluginManager interaction with Guice bug
Date Fri, 01 Feb 2013 11:12:54 GMT
On 31 January 2013 21:29, Martin Gainty <mgainty@hotmail.com> wrote:

>
> Gentlemen
> I found a consistent bug with PluginManager not able to locate @goal/** *
> artifactId=modello-maven-plugin
>  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
>  * @version 1.5
>  * @threadSafe
>  */
> public abstract class AbstractModelloGeneratorMojo extends AbstractMojo
> notice the lack of @goal .. because this is an abstract class which is
> expected to be extend'ed by a concrete
> the PluginManager backtraces classes to find who is extending AbstractMojo
> and correctly identifies
> org.codehaus.modello.maven.AbstractModelloGeneratorMojo
> org.apache.maven.plugin.MojoExecutionException: Error generating: No such
> plugin: java
>  at
> org.codehaus.modello.maven.AbstractModelloGeneratorMojo.doExecute(AbstractModelloGeneratorMojo.java:324)
>
> abstract class AbstractModelloGeneratorMojo has no @goal .. pluginManager
> will always throw MojoExecutionException
>
> solution is to have the concrete class which contains annotated @goal
> extend AbstractMojo
> /*** Echos an object string to the output screen.
>  * @goal java
>  * @requiresProject false
> @Mojo(name "java")
> */
> public class ModelloJavaMojo extends AbstractMojo implements
> org.codehaus.modello.core.ModelloCore
> { public void execute()
> }
>
> if I run mvn dependency:tree i can see the guice injector the
> modello-maven-plugin is expecting
> [DEBUG] org.codehaus.modello:modello-maven-plugin:maven-plugin:1.1
> [DEBUG]    com.google.inject:guice:jar:2.0:compile
>
> maven-core implements guice as well
> [DEBUG]    org.apache.maven:maven-core:jar:3.0.2:compile
> [DEBUG]       org.sonatype.sisu:sisu-guice:jar:2.9.1:compile
>
> the options seem to be
> 1)disable guice and replace with plexus..if you find a way please let me
> know
> 2)refactor all concrete classes which already implement @goal to extend
> AbstractMojo so PluginManager will
> find the Mojo which contains the expected goal from plugin.xml
>
> Thoughts?
>

Don't see how this relates to guice, seems more likely to be something to
do with the build-time generation of the plugin.xml. Suggest you create an
issue on http://jira.codehaus.org/browse/MPLUGIN and attach your test
project. Also I don't see anywhere in the PluginManager implementation
where it "backtraces classes to find who is extending AbstractMojo",
instead it looks up the implementation indirectly via the MojoDescriptor
that's populated from the plugin.xml.

-- 
Cheers, Stuart


> Martin Gainty
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message