I'm trying to reduce copy/pasting in our maven pom files.
We have one master pom and many children projects pom inheriting from the master.
I want to share a complex plugin definition looking like:
<plugins> ... <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>appassembler-maven-plugin</artifactId> <configuration> <!-- many xml lines here --> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>assemble</goal> <goal>generate-daemons</goal> <goal>create-repository</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.codehaus.mojo.appassembler</groupId> <artifactId>appassembler-booter</artifactId> <version>1.0</version> </dependency> </dependencies> </plugin> ... </plugins>
When this plugin definition is in the project pom, packaging is well done.
When definition is moved to parent pom (in or in ), then the packaging is not even started.
Is it possible to share a plugin configuration ? How ?
-- Edit after first answers---
I have tried the following:
- put my XL packaging plugin config in the element of my parent pom
- add this lines in my project pom in the element:
<plugins> ... <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>appassembler-maven-plugin</artifactId> </plugin> ... </plugins>
but it is not working... What can be wrong with that ?
-- last edit -- I think I get what was the problem:
the plugin re-use declaration should be declared in a profile build.
I done that in an always enabled plugin and now it is working fine.
Thanks a lot.
You could wrap the plugins of the parent in a
<plugin> ... </plugin>
Children plugins will then inherit the configurations when they declare the plugin in their build tag.
Have you tried using the plugin management feature of Maven? It'll allow you to push that configuration information down to the children pom.xml files from the parent pom.xml.
Now, not all plugins are as well done as those from the org.apache.maven.plugins group. It may be necessary to move your configuration section in between your execution elements.