You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Brian E. Fox" <br...@reply.infinity.nu> on 2007/09/26 07:21:00 UTC

RE: mojo inheritance

This is interesting functionality that the dev team should be aware of.
I know it's frequently asked how to extend a plugin.

--Brian

-----Original Message-----
From: mcculls@gmail.com [mailto:mcculls@gmail.com] On Behalf Of Stuart
McCulloch
Sent: Tuesday, September 25, 2007 11:21 AM
To: Maven Users List
Subject: mojo inheritance

Hi,

I've developed a small plugin that lets you extend mojos from other
maven
plugins by merging the plugin metadata:


http://www.ops4j.org/projects/pax/construct/maven-inherit-plugin/index.h
tml

I've successfully used this to extend various core plugins - is anyone
interested in this approach (or is it a bad idea?)

-- 
Cheers, Stuart

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: mojo inheritance

Posted by Rune Flobakk <rf...@online.no>.
I also find this quite interesting. I did some plugin development this 
spring, and I several times thought to myself "this is already done in 
<plugin-name>. If I am doing this I am duplicating code". In particular 
I was making a plugin which should compile some intermediary AspectJ 
sources without the user needing to worry about it, so it would be nice 
to call the compile mojo of the aspectj-maven-plugin and inject 
necessary configuration to adapt it to my use instead of coding my own 
compile mojo which used the AspectJ API (and looked very much alike the 
source of aspectj-maven-plugin).

I think I remember I've read somewhere that plugins should not depend on 
other plugins though. I will remember your inherit-plugin the next time 
I do plugin development :)

-Rune


Brian E. Fox wrote:
> This is interesting functionality that the dev team should be aware of.
> I know it's frequently asked how to extend a plugin.
>
> --Brian
>
> -----Original Message-----
> From: mcculls@gmail.com [mailto:mcculls@gmail.com] On Behalf Of Stuart
> McCulloch
> Sent: Tuesday, September 25, 2007 11:21 AM
> To: Maven Users List
> Subject: mojo inheritance
>
> Hi,
>
> I've developed a small plugin that lets you extend mojos from other
> maven
> plugins by merging the plugin metadata:
>
>
> http://www.ops4j.org/projects/pax/construct/maven-inherit-plugin/index.h
> tml
>
> I've successfully used this to extend various core plugins - is anyone
> interested in this approach (or is it a bad idea?)
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: mojo inheritance

Posted by Daniel Kulp <dk...@apache.org>.
Definitely useful...   I ran into this in the GPG plugin just last week.   
I added a sign-and-deploy-file mojo that I wanted to just extend the 
deploy-file mojo from the deploy plugin.    Ended up being a lot harder 
to do than I expected.   Had to resort to some reflection magic to fill 
in fields in the super class.    Really sucked actually.

Dan

On Wednesday 26 September 2007, Jason van Zyl wrote:
> On 25 Sep 07, at 10:21 PM 25 Sep 07, Brian E. Fox wrote:
> > This is interesting functionality that the dev team should be aware
> > of.
> > I know it's frequently asked how to extend a plugin.
>
> We could definitely integrate this method, would be highly useful.
>
> When we integrate the anno-mojo stuff we'll have this with
> annotations but doing this with the existing mechanism would be good.
>
> > --Brian
> >
> > -----Original Message-----
> > From: mcculls@gmail.com [mailto:mcculls@gmail.com] On Behalf Of
> > Stuart McCulloch
> > Sent: Tuesday, September 25, 2007 11:21 AM
> > To: Maven Users List
> > Subject: mojo inheritance
> >
> > Hi,
> >
> > I've developed a small plugin that lets you extend mojos from other
> > maven
> > plugins by merging the plugin metadata:
> >
> >
> > http://www.ops4j.org/projects/pax/construct/maven-inherit-plugin/
> > index.h
> > tml
> >
> > I've successfully used this to extend various core plugins - is
> > anyone interested in this approach (or is it a bad idea?)
> >
> > --
> > Cheers, Stuart
> >
> > --------------------------------------------------------------------
> >- To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> jason at sonatype dot com
> ----------------------------------------------------------
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


RE: mojo inheritance

Posted by Jörg Schaible <Jo...@Elsag-Solutions.com>.
Jason van Zyl wrote on Wednesday, September 26, 2007 7:59 AM:

> On 25 Sep 07, at 10:21 PM 25 Sep 07, Brian E. Fox wrote:
> 
>> This is interesting functionality that the dev team should be aware
>> of. I know it's frequently asked how to extend a plugin.
>> 
> 
> We could definitely integrate this method, would be highly useful.
> 
> When we integrate the anno-mojo stuff we'll have this with
> annotations but doing this with the existing mechanism would be good.

Just as a heads-up: This is only useful if it does not knock down the plugin version of the re-used plugin! We have currently such a situation with the XDoclet plugin that uses classes from the Antrun plugin. We need features from Anrun plugin 1.1, but the XDoclet plugin references Antrun plugin 1.0. For us the modules using the Antrun plugin suddenly fail, if a module using the XDoclet plugin runs first. In the end we used a locally modified version of the XDoclet plugin that contains a copy of the referenced classes of the Antrun plugin (with different package name) to get things running. Since we're still forced to run M205 things might have been improved regarding class loaders, but I'd bet the situation for plugin inheritance is still the same. So you should be *very* careful with such a functionality.

- Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: mojo inheritance

Posted by Jason van Zyl <ja...@maven.org>.
On 25 Sep 07, at 10:21 PM 25 Sep 07, Brian E. Fox wrote:

> This is interesting functionality that the dev team should be aware  
> of.
> I know it's frequently asked how to extend a plugin.
>

We could definitely integrate this method, would be highly useful.

When we integrate the anno-mojo stuff we'll have this with  
annotations but doing this with the existing mechanism would be good.

> --Brian
>
> -----Original Message-----
> From: mcculls@gmail.com [mailto:mcculls@gmail.com] On Behalf Of Stuart
> McCulloch
> Sent: Tuesday, September 25, 2007 11:21 AM
> To: Maven Users List
> Subject: mojo inheritance
>
> Hi,
>
> I've developed a small plugin that lets you extend mojos from other
> maven
> plugins by merging the plugin metadata:
>
>
> http://www.ops4j.org/projects/pax/construct/maven-inherit-plugin/ 
> index.h
> tml
>
> I've successfully used this to extend various core plugins - is anyone
> interested in this approach (or is it a bad idea?)
>
> -- 
> Cheers, Stuart
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
jason at sonatype dot com
----------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org