You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by tjunak <tj...@tlen.pl> on 2008/09/25 10:00:31 UTC

Plugin inheritance

Hi,

I have a following problem with plugin inheritance.

I have put a plugin with lot of configuration in Parent-Pom, there are lot
of child-poms in the project.
Most of them use the plugin configuration but in some cases I have to
re-define some options.
Let's say:

Parent-Pom:

<plugin>
<artifactId>my-plugin</artifactId>

 <configuration>

  <defines>
   <define>def-A</define>
   <define>def-B</define>
  </defines>

 </configuration>

</plugin>

In my real project there are much more such lists and elements.



Child-Pom:

Here I have to add some special define:

<plugin>
<artifactId>my-plugin</artifactId>

 <configuration>

  <defines>
   <define>def-C</define>
  </defines>

 </configuration>

</plugin>


The problem is that when I'm checking this with help:effective-pom I get
only this:

<defines>
 <define>def-C</define>
</defines>

which means whole list is overriden not elements on the list.

My expectation is to get:

<defines>
 <define>def-A</define>
 <define>def-B</define>
 <define>def-C</define>
</defines>

This causes that in a lot of child-poms I have re-write almost all
configuration from Parent-Pom which
of course will be later hard to maintain. 

Is there a way to inherit it on list elements level with Maven ?

Thank you in advance!
-- 
View this message in context: http://www.nabble.com/Plugin-inheritance-tp19664782p19664782.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Plugin inheritance

Posted by Nick Stolwijk <ni...@gmail.com>.
You would do something like this:

<configuration>
  <items combine.children="append">
    <item>three</item>
  </items>
</configuration>

See http://www.ejlife.net/blogs/buildchimp/2007/06/07/1181254122408.html

Hth,

Nick Stolwijk
~Java Developer~

Iprofs BV.
Claus Sluterweg 125
2012 WS Haarlem
www.iprofs.nl



On Mon, Sep 29, 2008 at 3:05 PM, Stephen Connolly
<st...@gmail.com> wrote:
> There is an attribute that you can specify to indicate that you are
> appending elements rather than replacing... if only I could remember it!
>
> 2008/9/29 tjunak <tj...@tlen.pl>
>
>>
>> I've checked it again - every time a whole list is overriden not elements
>> on
>> the list.
>> I have made few tries on different plugins - and the result is always the
>> same.
>>
>> I have dozens of child-pom where their configuration in many cases differ a
>> little.
>> It looks that it is needed to move whole configuration from Parent-Pom into
>> every child pom that need even a slight change in configuration (one extra
>> element on the list).  I hoped to keep common settings in Parent-Pom and
>> that I could add specific options in some child-poms. But then in that case
>> it is very hard to maintain - especially in a corporate level projects.
>>
>> Isn't it a bug?
>>
>> How does the merging work in Maven in case of list structure ?
>>
>> Thank you for any help!
>>
>>
>> Baptiste MATHUS-4 wrote:
>> >
>> > Hi,
>> >
>> > You should try <pluginManagement> node to manage this, see
>> > http://maven.apache.org/pom.html#Plugin_Management.
>> >
>> > Cheers.
>> >
>> > 2008/9/25 tjunak <tj...@tlen.pl>
>> >
>> >>
>> >> Hi,
>> >>
>> >> I have a following problem with plugin inheritance.
>> >>
>> >> I have put a plugin with lot of configuration in Parent-Pom, there are
>> >> lot
>> >> of child-poms in the project.
>> >> Most of them use the plugin configuration but in some cases I have to
>> >> re-define some options.
>> >> Let's say:
>> >>
>> >> Parent-Pom:
>> >>
>> >> <plugin>
>> >> <artifactId>my-plugin</artifactId>
>> >>
>> >>  <configuration>
>> >>
>> >>  <defines>
>> >>   <define>def-A</define>
>> >>   <define>def-B</define>
>> >>  </defines>
>> >>
>> >>  </configuration>
>> >>
>> >> </plugin>
>> >>
>> >> In my real project there are much more such lists and elements.
>> >>
>> >>
>> >>
>> >> Child-Pom:
>> >>
>> >> Here I have to add some special define:
>> >>
>> >> <plugin>
>> >> <artifactId>my-plugin</artifactId>
>> >>
>> >>  <configuration>
>> >>
>> >>  <defines>
>> >>   <define>def-C</define>
>> >>  </defines>
>> >>
>> >>  </configuration>
>> >>
>> >> </plugin>
>> >>
>> >>
>> >> The problem is that when I'm checking this with help:effective-pom I get
>> >> only this:
>> >>
>> >> <defines>
>> >>  <define>def-C</define>
>> >> </defines>
>> >>
>> >> which means whole list is overriden not elements on the list.
>> >>
>> >> My expectation is to get:
>> >>
>> >> <defines>
>> >>  <define>def-A</define>
>> >>  <define>def-B</define>
>> >>  <define>def-C</define>
>> >> </defines>
>> >>
>> >> This causes that in a lot of child-poms I have re-write almost all
>> >> configuration from Parent-Pom which
>> >> of course will be later hard to maintain.
>> >>
>> >> Is there a way to inherit it on list elements level with Maven ?
>> >>
>> >> Thank you in advance!
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Plugin-inheritance-tp19664782p19664782.html
>> >> Sent from the Maven - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> For additional commands, e-mail: users-help@maven.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > Baptiste <Batmat> MATHUS - http://batmat.net
>> > Sauvez un arbre,
>> > Mangez un castor !
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Plugin-inheritance-tp19664782p19722688.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>

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


Re: Plugin inheritance

Posted by Stephen Connolly <st...@gmail.com>.
There is an attribute that you can specify to indicate that you are
appending elements rather than replacing... if only I could remember it!

2008/9/29 tjunak <tj...@tlen.pl>

>
> I've checked it again - every time a whole list is overriden not elements
> on
> the list.
> I have made few tries on different plugins - and the result is always the
> same.
>
> I have dozens of child-pom where their configuration in many cases differ a
> little.
> It looks that it is needed to move whole configuration from Parent-Pom into
> every child pom that need even a slight change in configuration (one extra
> element on the list).  I hoped to keep common settings in Parent-Pom and
> that I could add specific options in some child-poms. But then in that case
> it is very hard to maintain - especially in a corporate level projects.
>
> Isn't it a bug?
>
> How does the merging work in Maven in case of list structure ?
>
> Thank you for any help!
>
>
> Baptiste MATHUS-4 wrote:
> >
> > Hi,
> >
> > You should try <pluginManagement> node to manage this, see
> > http://maven.apache.org/pom.html#Plugin_Management.
> >
> > Cheers.
> >
> > 2008/9/25 tjunak <tj...@tlen.pl>
> >
> >>
> >> Hi,
> >>
> >> I have a following problem with plugin inheritance.
> >>
> >> I have put a plugin with lot of configuration in Parent-Pom, there are
> >> lot
> >> of child-poms in the project.
> >> Most of them use the plugin configuration but in some cases I have to
> >> re-define some options.
> >> Let's say:
> >>
> >> Parent-Pom:
> >>
> >> <plugin>
> >> <artifactId>my-plugin</artifactId>
> >>
> >>  <configuration>
> >>
> >>  <defines>
> >>   <define>def-A</define>
> >>   <define>def-B</define>
> >>  </defines>
> >>
> >>  </configuration>
> >>
> >> </plugin>
> >>
> >> In my real project there are much more such lists and elements.
> >>
> >>
> >>
> >> Child-Pom:
> >>
> >> Here I have to add some special define:
> >>
> >> <plugin>
> >> <artifactId>my-plugin</artifactId>
> >>
> >>  <configuration>
> >>
> >>  <defines>
> >>   <define>def-C</define>
> >>  </defines>
> >>
> >>  </configuration>
> >>
> >> </plugin>
> >>
> >>
> >> The problem is that when I'm checking this with help:effective-pom I get
> >> only this:
> >>
> >> <defines>
> >>  <define>def-C</define>
> >> </defines>
> >>
> >> which means whole list is overriden not elements on the list.
> >>
> >> My expectation is to get:
> >>
> >> <defines>
> >>  <define>def-A</define>
> >>  <define>def-B</define>
> >>  <define>def-C</define>
> >> </defines>
> >>
> >> This causes that in a lot of child-poms I have re-write almost all
> >> configuration from Parent-Pom which
> >> of course will be later hard to maintain.
> >>
> >> Is there a way to inherit it on list elements level with Maven ?
> >>
> >> Thank you in advance!
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Plugin-inheritance-tp19664782p19664782.html
> >> Sent from the Maven - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
> >
> > --
> > Baptiste <Batmat> MATHUS - http://batmat.net
> > Sauvez un arbre,
> > Mangez un castor !
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Plugin-inheritance-tp19664782p19722688.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Plugin inheritance

Posted by tjunak <tj...@tlen.pl>.
I've checked it again - every time a whole list is overriden not elements on
the list.
I have made few tries on different plugins - and the result is always the
same.

I have dozens of child-pom where their configuration in many cases differ a
little. 
It looks that it is needed to move whole configuration from Parent-Pom into
every child pom that need even a slight change in configuration (one extra
element on the list).  I hoped to keep common settings in Parent-Pom and
that I could add specific options in some child-poms. But then in that case
it is very hard to maintain - especially in a corporate level projects. 

Isn't it a bug? 

How does the merging work in Maven in case of list structure ?

Thank you for any help!


Baptiste MATHUS-4 wrote:
> 
> Hi,
> 
> You should try <pluginManagement> node to manage this, see
> http://maven.apache.org/pom.html#Plugin_Management.
> 
> Cheers.
> 
> 2008/9/25 tjunak <tj...@tlen.pl>
> 
>>
>> Hi,
>>
>> I have a following problem with plugin inheritance.
>>
>> I have put a plugin with lot of configuration in Parent-Pom, there are
>> lot
>> of child-poms in the project.
>> Most of them use the plugin configuration but in some cases I have to
>> re-define some options.
>> Let's say:
>>
>> Parent-Pom:
>>
>> <plugin>
>> <artifactId>my-plugin</artifactId>
>>
>>  <configuration>
>>
>>  <defines>
>>   <define>def-A</define>
>>   <define>def-B</define>
>>  </defines>
>>
>>  </configuration>
>>
>> </plugin>
>>
>> In my real project there are much more such lists and elements.
>>
>>
>>
>> Child-Pom:
>>
>> Here I have to add some special define:
>>
>> <plugin>
>> <artifactId>my-plugin</artifactId>
>>
>>  <configuration>
>>
>>  <defines>
>>   <define>def-C</define>
>>  </defines>
>>
>>  </configuration>
>>
>> </plugin>
>>
>>
>> The problem is that when I'm checking this with help:effective-pom I get
>> only this:
>>
>> <defines>
>>  <define>def-C</define>
>> </defines>
>>
>> which means whole list is overriden not elements on the list.
>>
>> My expectation is to get:
>>
>> <defines>
>>  <define>def-A</define>
>>  <define>def-B</define>
>>  <define>def-C</define>
>> </defines>
>>
>> This causes that in a lot of child-poms I have re-write almost all
>> configuration from Parent-Pom which
>> of course will be later hard to maintain.
>>
>> Is there a way to inherit it on list elements level with Maven ?
>>
>> Thank you in advance!
>> --
>> View this message in context:
>> http://www.nabble.com/Plugin-inheritance-tp19664782p19664782.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> -- 
> Baptiste <Batmat> MATHUS - http://batmat.net
> Sauvez un arbre,
> Mangez un castor !
> 
> 

-- 
View this message in context: http://www.nabble.com/Plugin-inheritance-tp19664782p19722688.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Plugin inheritance

Posted by Baptiste MATHUS <ml...@batmat.net>.
Hi,

You should try <pluginManagement> node to manage this, see
http://maven.apache.org/pom.html#Plugin_Management.

Cheers.

2008/9/25 tjunak <tj...@tlen.pl>

>
> Hi,
>
> I have a following problem with plugin inheritance.
>
> I have put a plugin with lot of configuration in Parent-Pom, there are lot
> of child-poms in the project.
> Most of them use the plugin configuration but in some cases I have to
> re-define some options.
> Let's say:
>
> Parent-Pom:
>
> <plugin>
> <artifactId>my-plugin</artifactId>
>
>  <configuration>
>
>  <defines>
>   <define>def-A</define>
>   <define>def-B</define>
>  </defines>
>
>  </configuration>
>
> </plugin>
>
> In my real project there are much more such lists and elements.
>
>
>
> Child-Pom:
>
> Here I have to add some special define:
>
> <plugin>
> <artifactId>my-plugin</artifactId>
>
>  <configuration>
>
>  <defines>
>   <define>def-C</define>
>  </defines>
>
>  </configuration>
>
> </plugin>
>
>
> The problem is that when I'm checking this with help:effective-pom I get
> only this:
>
> <defines>
>  <define>def-C</define>
> </defines>
>
> which means whole list is overriden not elements on the list.
>
> My expectation is to get:
>
> <defines>
>  <define>def-A</define>
>  <define>def-B</define>
>  <define>def-C</define>
> </defines>
>
> This causes that in a lot of child-poms I have re-write almost all
> configuration from Parent-Pom which
> of course will be later hard to maintain.
>
> Is there a way to inherit it on list elements level with Maven ?
>
> Thank you in advance!
> --
> View this message in context:
> http://www.nabble.com/Plugin-inheritance-tp19664782p19664782.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Re: Plugin inheritance

Posted by tjunak <tj...@tlen.pl>.
Hi,

thank you for your reply. So I have tried it. I have moved plugin and its
configuration into <pluginManagement> section in Parent-Pom.

Unfortunatelly again - whole list is overriden instead the elements on the
list.

Is it possible for maven to merge elements of list in configuration section
defined in child poms (as in the example described in my first e-mail) ?



tjunak wrote:
> 
> Hi,
> 
> I have a following problem with plugin inheritance.
> 
> I have put a plugin with lot of configuration in Parent-Pom, there are lot
> of child-poms in the project.
> Most of them use the plugin configuration but in some cases I have to
> re-define some options.
> Let's say:
> 
> Parent-Pom:
> 
> <plugin>
> <artifactId>my-plugin</artifactId>
> 
>  <configuration>
> 
>   <defines>
>    <define>def-A</define>
>    <define>def-B</define>
>   </defines>
> 
>  </configuration>
> 
> </plugin>
> 
> In my real project there are much more such lists and elements.
> 
> 
> 
> Child-Pom:
> 
> Here I have to add some special define:
> 
> <plugin>
> <artifactId>my-plugin</artifactId>
> 
>  <configuration>
> 
>   <defines>
>    <define>def-C</define>
>   </defines>
> 
>  </configuration>
> 
> </plugin>
> 
> 
> The problem is that when I'm checking this with help:effective-pom I get
> only this:
> 
> <defines>
>  <define>def-C</define>
> </defines>
> 
> which means whole list is overriden not elements on the list.
> 
> My expectation is to get:
> 
> <defines>
>  <define>def-A</define>
>  <define>def-B</define>
>  <define>def-C</define>
> </defines>
> 
> This causes that in a lot of child-poms I have re-write almost all
> configuration from Parent-Pom which
> of course will be later hard to maintain. 
> 
> Is there a way to inherit it on list elements level with Maven ?
> 
> Thank you in advance!
> 

-- 
View this message in context: http://www.nabble.com/Plugin-inheritance-tp19664782p19684173.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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