You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Dennis Lundberg <de...@apache.org> on 2008/05/01 12:16:20 UTC
Re: Can plugins be extended?
If what you are after, is to add extra source directories to your build,
you should have a look at the build helper plugin:
http://mojo.codehaus.org/build-helper-maven-plugin/
walid joseph Gedeon wrote:
> 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 = org.apache.maven.project.MavenProject@82bcf39e
> [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)
> ...
>
--
Dennis Lundberg
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Can plugins be extended?
Posted by walid joseph Gedeon <wg...@gmail.com>.
Yep that's all I needed. Thanks for the pointer! ;-)
w
On Thu, May 1, 2008 at 12:16 PM, Dennis Lundberg <de...@apache.org> wrote:
> If what you are after, is to add extra source directories to your build,
> you should have a look at the build helper plugin:
>
> http://mojo.codehaus.org/build-helper-maven-plugin/
>
>
> walid joseph Gedeon wrote:
>
> > 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 = org.apache.maven.project.MavenProject@82bcf39e
> > [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)
> > ...
> >
> >
>
> --
> Dennis Lundberg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>