Hi Stuart,
I tried it and it worked like a charm.
Great plugin !
Thanks a lot.
--
Julien
PS: thank you Rémy and Sahoo too for your answers
On Thu, Feb 21, 2008 at 11:45:09AM +0800, Stuart McCulloch wrote:
> On 21/02/2008, Julien Stern <[EMAIL PROTECTED]> wrote:
> >
> > Hi list,
> >
> > I just tried to "extend" a plugin, by creating a local plugin
> > with a Mojo that extends (in the Java sense) an other Mojo
> > from an existing plugin.
> >
> > It overrides the execute method and calls several "super" methods
> > along with doing its own work.
> >
> > However, when I try to execute the plugin, none of the "parameters"
> > seem to be set and I keep on getting NullPointerExceptions.
> >
> > For instance, "project", as defined below in a super class in "null".
> >
> > /**
> > * POM.
> > *
> > * @parameter expression="${project}"
> > * @readonly
> > * @required
> > */
> > protected MavenProject project;
> >
> > It that a bug? Is there a way to do want I'm trying to do?
>
>
> Hi Julien,
>
> when you build a maven plugin, the [plugin:descriptor] goal generates an XML
> file
> to target/classes/META-INF/maven/plugin.xml that tells the plexus container
> what
> fields need to be injected, and where to get them from (along with defaults,
> etc.)
>
> unfortunately, the tool used to generate the plugin.xml works on javadoc
> comments
> which means that when you extend a mojo from another project, it doesn't see
> the
> source (and therefore the javadoc) and doesn't add the fields to the
> plugin.xml
>
> this means when you come to use the extended mojo, a lot of the fields will
> be null.
>
> I do have a tool (another maven plugin) that will help add inherited fields
> and goals
> to the plugin.xml, which is documented here (may upload it to repo1 if it's
> useful):
>
>
> http://www.ops4j.org/projects/pax/construct/maven-inherit-plugin/index.html
>
> however, you do need to have the plugin being extended as a dependency in
> your
> new plugin project, and some people have said this is not necessarily a good
> thing
>
> btw, if you have commit access to both codebases, another solution is to
> refactor
> the common code into a plexus component that can then be used in both
> plugins.
>
> HTH
>
> Regards,
> >
> >
> > --
> > Julien
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> --
> Cheers, Stuart
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]