maven2: how to share a plugin configuration between parent and children pom?

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.

-------------Problems Reply------------

You could wrap the plugins of the parent in a <pluginManagement> tag.

<pluginManagement>
<plugins>
<plugin> ... </plugin>
</plugins>
</pluginManagemenet>

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.

Category:maven 2 Views:3 Time:2010-11-10

Related post

  • Maven include another pom for plugin configuration 2011-04-20

    is there a way to include another pom or information in a maven pom ? I have several poms which are basically not related or have different parent poms. Nevertheless for packaging it is required to have a Manifest identical to all projects. So curren

  • maven surefire reporting plugin configuration 2009-08-13

    I have a multi-module maven project. The parent pom.xml is simply a way to reference common information for the 4 subprojects. I have quite a few JUnit tests that run and I also have the Parent Project set up for Project WebSite using the maven-info-

  • Hudson, is it possible to make a plugin configuration non-visible depending on job type? 2010-06-17

    With the plugin (SCM plugin) I'm working on the problem is that it doesn't work in any other job/project type than Freestyle-project. I'd like to hide the plugin configuration from project configuration page on other job/project types (maven, matrix

  • gwt maven war plugin configuration problem 2010-12-30

    I am developing a gwt application in maven. In this I am using maven war plugin. Everything works fine. When I give mvn install command it builds abc.war file in target folder. But it is not copying compiled javascript files ("module1" and "module2"

  • Maven plugin configuration in the multi module project 2011-05-27

    I'm working on the multi module project. I want to run my plugin after build for one of the modules. This mojo should be only run directly from CLI and can not be attached to the phase as on some environments we dont want to run this goal. What is th

  • Maven common parent with custom reporting plugin configuration 2011-07-25

    My team has a common parent project with a module containing several reporting plugin configurations (e.g. checkstyle and findbugs, similar to Checkstyle's multimodule configuration, but in a separate project). I'm going to call the common parent pro

  • How do I preserve whitespace in a Maven plugin configuration? 2011-09-12

    I have a plugin configuration parameter named suffix. I would like the user to be able to specify a newline (a literal character produced by pressing the Return key, not some escaped variant, although I'll get to that) as the value for that parameter

  • Maven2 sharing dependencies across parent and children (without redeclaring dependencies in children) 2010-07-09

    With maven1 I was using the extend tag to tell my children project to use their parent configuration. All dependencies declared in the parent were available in extending (children) projects. Now with maven2 I'm using the inheritance/composition featu

  • Issue in plugin dependency jar in multi-module pom 2010-06-25

    There is a top level pom.xml which calls two sub modules as below: <modules> <module>module1</module> <module>module2</module> </modules> Where module2 is dependent on module1 The xjc plugin configuration in module

  • Sharing code AND configuration using parent module in Maven 2012-09-26

    In my project I have two modules (A,B) depend on common module C. I would like A,B share common configuration, such as repository configuration, plugin configuration, etc. In order to achieve this, C is made the parent pom and A,B inherit from it (no

  • Execute Maven plugin goal on parent module, but not on children 2009-11-03

    We have a multi-module maven project that uses a profile that defines a buildnumber-maven-plugin to increment a build number and then check it into source control. If I define the plugin in the parent pom.xml it executes for all the child builds as w

  • "Child-only configuration" in parent POM / NOOP Parent POM 2013-12-22

    I have a project generating code. The generation takes really long, so I've split it in multiple projects, each generating 20% of the whole. The original POM became the "parent POM", and the children depend on it, containing only an individual artifa

  • Prism: Share ViewModel's property in parent ViewModel 2011-09-01

    I'm developing WPF Prism application using Unity container. The issue is: I have a ListBox, each element has it's own ViewModel. In that element I need to select a location from a list of locations. List of locations is the same for all elements. How

  • Hudson with PMD-Plugin configured for android maven2 project 2011-05-30

    I'm currently running into a problem using Hudson's PMD-plugin on a maven2-android project. The part within my POM look like this: <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId

  • maven cargo plugin configuration for Jboss as 7.1.0 2012-03-01

    I am trying to configure the maven cargo plugin for deployment on existing jboss 7.1.0 on my local machine. I am able to start the server by mvn cargo :run command. It is using the jboss-modules.jar to start the server. I want to configure it in such

  • How does Maven2 know where to find plugins? 2009-07-21

    I'm using Maven2 and I can't seem to find any plugins in my repository. I'm getting errors like repository metadata for: 'org.apache.maven.plugins' could not be found on repository: myrepo where myrepo is the name of my repository. My question is how

  • Maven2: How to stage JXR plugin result when using mvn site? 2009-07-31

    I have a multi-module project and I want to deploy on the project's site an HTML version of my source code using the JXR maven plugin. The problem is that the JXR plugin runs well, the XREF folder is properly generated for each of my module, but when

  • Restricting Java maven plugin configuration parameters 2009-08-20

    I’m writing a maven plugin with a number of configurable parameters. There are a number of parameters specified in the Mojo class. One of these parameters is required and must contain certain values (let’s say, either ‘Atwood’ or ‘Spolsky’). At the m

  • Plugin configuration in Eclipse 2009-11-25

    I'm investigating the use of Eclipse as a platform and I am trying to figure out how a plugin provides configuration. For example, say I have a plugin to display a user defined message. Further, I want that user defined message to be configured by th

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.153 (s). 11 q(s)