Similar question here.
I would like to get ONE resulting WAR to be deployed from 3 different maven modules. The war modules are absolutely non-conflicting :
This just requires a little advanced use of maven jar & war plugin.
First one that has Java classes and some WEB-INF/artifacts
Let say this represents the main WAR. You just use maven-war-plugin's Overlays feature. The most basic way is specifying the war dependency :
${groupId}
${rootArtifactId}-service-impl
${version}
war
runtime
and tell maven war plugin to merge assets of this dependency into the main war (where we are now)
maven-war-plugin
WEB-INF/web.xml,**/**.class
src/main/webapp/WEB-INF
true
WEB-INF
You also include a jar type dependency on the second one (it will be a JAR in WEB-INF/lib/
)
${groupId}
${rootArtifactId}-service
${version}
jar
And you also need to specify dependency on the classes from the third WAR :
${groupId}
${rootArtifactId}-service-impl
${version}
classes
jar
Notice of the classifier, it is necessary because you are specifying 2 dependencies of the same artifact... To make it work, you have to set up jar plugin in the third artifact (war type artifact), regarding the classifier and the fact that you need 2 packages from one artifacts (war & jar):
org.apache.maven.plugins
maven-jar-plugin
package
jar
classes
**/**.class