build - Maven plugin inheritance from pluginManagement -


there

i have parent pom.xml defines the default configuration maven-ear-plugin

<pluginmanagement>     <plugins>         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-ear-plugin</artifactid>             <version>2.8</version>             <configuration>                 <modules>                     <jarmodule>                         <groupid>com.test</groupid>                         <artifactid>artifact1</artifactid>                     </jarmodule>                     <jarmodule>                         <groupid>com.test</groupid>                         <artifactid>artifact2</artifactid>                     </jarmodule>                 </modules>             </configuration>         </plugin>     </plugins> </pluginmanagement> 

in child pom, defined maven-ear-plugin in <plugins> section

<plugin>     <artifactid>maven-ear-plugin</artifactid>     <executions>         <execution>             <id>default-ear</id>             <phase>package</phase>             <goals>                 <goal>ear</goal>             </goals>             <configuration>                 <earsourcedirectory>earcontent</earsourcedirectory>                 <defaultlibbundledir>app-inf/lib</defaultlibbundledir>                 <modules>                     <jarmodule>                         <groupid>com.test</groupid>                         <artifactid>artifact3</artifactid>                     </jarmodule>                 </modules>             </configuration>         </execution>     </executions> </plugin> 

my intention include 3 jar files artifact1, artifact2 , artifact3 in ear. however, after build, artifact3 defined in child pom.xml included. looks default <modules> definition in child pom.xml overwrites what's defined in parent pom, instead of merge them together. in fact, if remove whole <modules> section in child pom.xml, artifact1 , artifact2 included after build.

my question whether there way include jar modules defined in parent pom , child pom. have several ear projects , of them need include same set of jar modules plus few jar modules of own. trying move common set of jar modules parent not repeated in each child pom.xml.

update clarify projects relations:

parent pom.xml (define maven-ear-plugin in pluginmanagement section)   -- project1 pom.xml (multi-module project)       -- myjar-proj1        -- myweb-proj1       -- myear-proj1 (define maven-ear-plugin in <build> section)       -- project2 pom.xml (multi-module project)       -- myjar-proj2       -- myweb-proj2       -- myear-proj2 (define maven-ear-plugin in <build> section) 

in order achieve merge behavior should put maven-ear-plugin under plugins tag in parent pom (rather under pluginmanagement).

parent pom:

<build>     <plugins>         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-ear-plugin</artifactid>             <version>2.8</version>             <configuration>                 <modules>                     <jarmodule>                         <groupid>com.test</groupid>                         <artifactid>artifact1</artifactid>                     </jarmodule>                     <jarmodule>                         <groupid>com.test</groupid>                         <artifactid>artifact2</artifactid>                     </jarmodule>                 </modules>             </configuration>         </plugin>     </plugins> </build> 

edit

after op's clarified projects structure: attribute combine.children="append" on modules element, in child projects:

<modules combine.children="append">     <jarmodule>         <groupid>com.test</groupid>         <artifactid>artifact3</artifactid>     </jarmodule> </modules> 

the parent should still define plugin in pluginmanagement.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -