I've got a Maven2 project with two submodules, laid out like this:
parentproject
|---war-file-project
|---applet-project
The POMs in each of them have the appropriate parent-module relationships. The applet-project
contains a simple applet and is set up with JAR packaging. The war-file-project
contains a simple WAR file project and is set up with WAR packaging.
When I build, I'd like to make sure that the WAR file contains the resulting JAR file from the applet-project
in the /applets
directory.
How do I do this?
To achieve that you can simply use the maven-dependency-plugin to copy the dependency to an appropriate location.
Created a complete example which you can use as a template.
Thanks khmarbaise for an excellent template!
I've also found one might want to adjust it with the following changes:
<scope>provided</scope>
to the 'supplemental' dependency in war/pom.xml - then supplemental.jar will not be duplicated at /WEB-INF/lib<stripVersion>true</stripVersion>
to the example maven-dependency-plugin configuration - then applet will be in 'supplemental.jar' instead of something like 'supplemenal-0.1.0-SNAPSHOT.jar'${project.artifactId}-${project.version}
in <outputDirectory>
to a more reliable ${project.build.finalName}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With