3

I’m using Maven 3.3.3 with the Maven WAR 2.6 plugin. I have a multi module project with both JAR and WAR projects within it. My WAR projects depend on my JAR projects, however, I do not want to package my WAR files, opting instead to keep them in an exploded form. So I tried running this command

/usr/local/apache-maven-3.3.3/bin/mvn -B -f /home/jboss/.jenkins/jobs/subco/workspace/pom.xml -B clean prepare-package war:exploded -DskipTests -T 3

Although this keeps my WAR exploded, the JAR projects do not get included in my web application’s target/myproject/WEB-INF/lib directory. Instead what is included are empty directories where my JAR files would have been, for instance

.jenkins/jobs/subco/workspace/myproject/target/myproject/WEB-INF/lib/child-jar-module-2.0.0-SNAPSHOT.jar/

How can I keep an exploded WAR, include my JAR files, and do it all from the command line (as opposed to creating a custom profile in my parent pom to do it for me)?

Edit: If you think this is a duplicate of another one, notice the part of my question where i point out that empty directories are generated when using the "prepare-package" phase. I don't want that.

Dave
  • 15,639
  • 133
  • 442
  • 830
  • Possible duplicate of [How to get Maven to run war:exploded but not war:war](http://stackoverflow.com/questions/352612/how-to-get-maven-to-run-warexploded-but-not-warwar) – michaldo Apr 24 '16 at 19:45
  • The command line option they suggest, using the "prepare-package" Maven lifecycle phase, causes the empty directories to be generated, as is described in my question. – Dave Apr 25 '16 at 19:41
  • The comments to command line option suggest that is does not work (well). I tried to reproduce it and `prepare-package war:exploded` does not work for my multi-project. I suspect there is no option to reach what you want, at least in elegant way. BTW, you wrote *creating a custom profile in my parent pom*, you should wrote *creating a custom profile in my pom*, because parent pom may remain unchanged – michaldo Apr 25 '16 at 21:39

0 Answers0