[ https://jira.codehaus.org/browse/MWAR-318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=353894#comment-353894 ]
Karl-Heinz Marbaise commented on MWAR-318: ------------------------------------------ I have [created an example|https://github.com/khmarbaise/mwar/tree/master/mwar-318] which works without any problem. I have called from the root of this example: {{mvn clean package}} May be you can take a look into the example and give me hints what you done different and what has not work as you expected. The only way i can explain your output is. You have first created the project made {{mvn install}} and afterwards changed the type of war2 into {{war}} (also packaging of war2 module) and ran a second time. Otherwise it's not possible to get an jar which is expanded from the local repository. Apart from that a general tip in relationship with multi module builds. Your build must work just by simply doing {{mvn clean package}} nothing is necessary. If you have the symptom to do {{mvn install}} once and afterwards it's running sucessfull something is wrong in your build. And best to check if everything is ok. Delete your local repository first. > WAR overlay does not work when building child modules from the parent > --------------------------------------------------------------------- > > Key: MWAR-318 > URL: https://jira.codehaus.org/browse/MWAR-318 > Project: Maven WAR Plugin > Issue Type: Bug > Components: overlay > Affects Versions: 2.4 > Reporter: Alan Czajkowski > Fix For: backlog > > > project layout: > root/pom.xml (parent POM, packaging: pom) > root/war1/pom.xml (packaging: war) > root/war2/pom.xml (packaging: war) > war2 artifact will overlay on top of war1 artifact > war2 plugin definition: > {code} > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-war-plugin</artifactId> > <version>2.4</version> > <configuration> > <attachClasses>true</attachClasses> > <dependentWarIncludes>**</dependentWarIncludes> > <overlays> > <overlay> > <id>war1</id> > <groupId>com.example</groupId> > <artifactId>war1</artifactId> > <type>war</type> > </overlay> > <overlay> > <!-- empty groupId/artifactId represents the current build --> > </overlay> > </overlays> > </configuration> > </plugin> > {code} > running: {{mvn clean install}} > when building the entire project from the _*parent*_ (root/pom.xml) the > overlay does not work, when building just from the _*child*_ > (root/war2/pom.xml) the overlay does work, see debug output below: > building from the _*parent*_, the packaging of war2 fails, running [mvn clean > install] from root/: > {code} > [DEBUG] OverlayPackagingTask performPackaging overlay.getTargetPath() null > [INFO] Processing overlay [ id war1] > [DEBUG] Expanding: > /Users/bingo/dev/example/root/war1/target/war1-1.0-SNAPSHOT.jar into > /Users/bingo/dev/example/root/war2/target/war/work/com.example/war1 > [DEBUG] expand complete > {code} > building from the _*child*_, the packaging of war2 is successful, running > [mvn clean install] from root/war2/: > {code} > [DEBUG] OverlayPackagingTask performPackaging overlay.getTargetPath() null > [INFO] Processing overlay [ id war1] > [DEBUG] Expanding: > /Users/bingo/.m2/repository/com/example/war1/1.0-SNAPSHOT/war1-1.0-SNAPSHOT.war > into /Users/bingo/dev/example/root/war2/target/war/work/com.example/war1 > [DEBUG] expand complete > {code} > notice how when you build from the _*parent*_, for some reason it thinks the > overlay is a JAR instead of a WAR: > {code} > [DEBUG] Expanding: > /Users/bingo/dev/example/root/war1/target/war1-1.0-SNAPSHOT.jar into > /Users/bingo/dev/example/root/war2/target/war/work/com.example/war1 > {code} > but when you build from the _*child*_ it works properly, same command on both -- This message was sent by Atlassian JIRA (v6.1.6#6162)