You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Chris Berry <ch...@gmail.com> on 2005/11/02 15:16:22 UTC

Plugin Inheritance

Greetings,
I am looking for guidance on POM inheritance. I know that I can set up a
build system where all common functionality is pulled into a Parent POM, so
that Child POMs can be remarkably small. What I'm uncertain on is how I
override some of the plugins -- leaving the others as is. I see that I can
override properties and customize the common plugin use that way. But can I
completely override a particular plugin?? Or perhaps add another plugin?? I
guess I'm looking for the rules of inheritance...

I.e can I override a plugin like this?? Is there a better way to supply
different configuration sets??

Parent POM:

<project>
....
<build>
<plugins>
<plugin>
....
<artifactId>my-plugin</artifactId>
<configuration>
<something>val1</something>
</configuration>
</plugin>


Child POM

<project>
....
<parent>....</parent>
<build>
<plugins>
<plugin>
....
<artifactId>my-plugin</artifactId>
<configuration>
<something>val2</something>
<somethingelse>val3</somethingelse>
</configuration>
</plugin>

Thanks,
-- Chris

Re: Plugin Inheritance

Posted by John Casey <jd...@commonjava.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sorry, I'm tracking a little behind on the list. ;)

Just for completeness, I should mention that it *is* possible to write a
plugin which is *not* inherited by default. When this is the case, the
user can still override this by specifying:

<inherited>true</inherited>

inside the plugin definition (within the parent POM).

- -john

Chris Berry wrote:
| I can now answer this myself.
| It appears that m2 does "the right thing" -- i.e. what you'd expect
| All plugins are inherited from the Parent. To override any Plugin, simply
| declare it in the Child. Those you don't declare remain unchanged. All
| <configuration> in the overriding Plugin declaration is inherited. And you
| can override any config properties or add new ones where necessary.
| Powerful, good stuff. This, plus the ability to parameterize with
| <properties>, makes it really easy to create a malleable "build system"
| good job maven guys ;-)
| Cheers,
| -- Chris
|
| On 11/2/05, Chris Berry <ch...@gmail.com> wrote:
|
|>Greetings,
|>I am looking for guidance on POM inheritance. I know that I can set up a
|>build system where all common functionality is pulled into a Parent
POM, so
|>that Child POMs can be remarkably small. What I'm uncertain on is how I
|>override some of the plugins -- leaving the others as is. I see that I can
|>override properties and customize the common plugin use that way. But
can I
|>completely override a particular plugin?? Or perhaps add another
plugin?? I
|>guess I'm looking for the rules of inheritance...
|>
|>I.e can I override a plugin like this?? Is there a better way to supply
|>different configuration sets??
|>
|>Parent POM:
|>
|><project>
|>....
|><build>
|><plugins>
|><plugin>
|>....
|><artifactId>my-plugin</artifactId>
|><configuration>
|><something>val1</something>
|></configuration>
|></plugin>
|>
|>
|>Child POM
|>
|><project>
|>....
|><parent>....</parent>
|><build>
|><plugins>
|><plugin>
|>....
|><artifactId>my-plugin</artifactId>
|><configuration>
|><something>val2</something>
|><somethingelse>val3</somethingelse>
|></configuration>
|></plugin>
|>
|>Thanks,
|>-- Chris
|>
|>
|>
|>
|>
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDaSEwK3h2CZwO/4URAjNYAKCphwobRsVVPR/dansXyiyILK3A4wCgq2ar
SgSzPp1SFvAo1RyvfsMj5O0=
=vwGZ
-----END PGP SIGNATURE-----

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


Re: Plugin Inheritance

Posted by Chris Berry <ch...@gmail.com>.
I can now answer this myself.
It appears that m2 does "the right thing" -- i.e. what you'd expect
All plugins are inherited from the Parent. To override any Plugin, simply
declare it in the Child. Those you don't declare remain unchanged. All
<configuration> in the overriding Plugin declaration is inherited. And you
can override any config properties or add new ones where necessary.
Powerful, good stuff. This, plus the ability to parameterize with
<properties>, makes it really easy to create a malleable "build system"
good job maven guys ;-)
Cheers,
-- Chris

On 11/2/05, Chris Berry <ch...@gmail.com> wrote:
>
> Greetings,
> I am looking for guidance on POM inheritance. I know that I can set up a
> build system where all common functionality is pulled into a Parent POM, so
> that Child POMs can be remarkably small. What I'm uncertain on is how I
> override some of the plugins -- leaving the others as is. I see that I can
> override properties and customize the common plugin use that way. But can I
> completely override a particular plugin?? Or perhaps add another plugin?? I
> guess I'm looking for the rules of inheritance...
>
> I.e can I override a plugin like this?? Is there a better way to supply
> different configuration sets??
>
> Parent POM:
>
> <project>
> ....
> <build>
> <plugins>
> <plugin>
> ....
> <artifactId>my-plugin</artifactId>
> <configuration>
> <something>val1</something>
> </configuration>
> </plugin>
>
>
> Child POM
>
> <project>
> ....
> <parent>....</parent>
> <build>
> <plugins>
> <plugin>
> ....
> <artifactId>my-plugin</artifactId>
> <configuration>
> <something>val2</something>
> <somethingelse>val3</somethingelse>
> </configuration>
> </plugin>
>
> Thanks,
> -- Chris
>
>
>
>
>