Thanks! I'll give it a try. On Tue, Apr 29, 2008 at 4:40 PM, <[EMAIL PROTECTED]> wrote:
> This is a known issue [1]. Short answer: no, it is not possible. Long > answer: maven-inherit-plugin [2] I don't have any experience with it, but > you could give it a try. > > Hth, > > Nick S. > > [1] http://jira.codehaus.org/browse/MNG-3042 > [2] http://www.ops4j.org/projects/pax/construct/maven-inherit-plugin/ > > > -----Original Message----- > From: walid joseph Gedeon [mailto:[EMAIL PROTECTED] > Sent: Tue 4/29/2008 16:37 > To: Maven Developers List > Subject: Can plugins be extended? > > Hello all, > After failing to customize the compiler pluging (by passing > <compileSourceRoots /> in the maven-compiler-plugin <configuration />); > I've > went onto trying to extend the maven-compiler-plugin CompileMojo to just > set > that variable. > > It looks like I've missed something: the injected parameters of the super > classes are not being set (e.g. the parameter compilerId, or the component > compilerManager in AbstractCompilerMojo are null). > Is there a flag that enables injection of parameters in super classes? Or > is > the issue something else? > > Thanks :-) > Walid. > > Note: a component definition maps the custom-compile goal to the <compile > /> > phase. > > o====x maven-customcompile-plugin Mojo: x====o > /** > * @goal custom-compile > * @phase compile > * @requiresDependencyResolution runtime > */ > public class CustomCompilerMojo extends CompilerMojo { > // ... > > /** > * @parameter > */ > private List<String> compileSourceRoots; > > protected List<String> getCompileSourceRoots() > { > return compileSourceRoots; > } > > public void execute() throws MojoExecutionException, > CompilationFailureException > { > super.execute(); > } > } > > o====x Project POM: x====o > <!-- ... --> > <build> > <plugins> > <plugin> > <groupId>fr.gedeon</groupId> > <artifactId>maven-customcompile-plugin</artifactId> > <extensions>true</extensions> > <configuration> > <compileSourceRoots> > <directory>Dev/src/java</directory> > </compileSourceRoots> > </configuration> > </plugin> > </plugins> > </build> > > o====x Partial Trace: x====o > [DEBUG] Configuring mojo > 'fr.gedeon:maven-customcompile-plugin:1.0-SNAPSHOT:custom-compile' --> > [DEBUG] (f) compileSourceRoots = [Dev/src/java] > [DEBUG] (f) project = [EMAIL PROTECTED] > [DEBUG] -- end configuration -- > [INFO] [bem:custom-compile] > [DEBUG] Using compiler 'null'. > > ^ this is from getLog().debug( "Using compiler '" + compilerId + > "'." ); > > in AbstractCompilerMojo > [INFO] > ------------------------------------------------------------------------ > [ERROR] FATAL ERROR > [INFO] > ------------------------------------------------------------------------ > [INFO] null > [INFO] > ------------------------------------------------------------------------ > [DEBUG] Trace > java.lang.NullPointerException > at > > org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:267) > > ^ I suppose this is compiler = compilerManager.getCompiler( > compilerId ); > > with compilerManager = null > at > org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114) > at > org.apache.maven.plugin.CompileBemMojo.execute(CompileBemMojo.java:37) > ... > >