maven-war-plugin を使用すると、すべての Web ファイルを含む war ファイルを作成し、それを依存プロジェクトのオーバーレイとして使用できます。
このようなプロジェクトにUIコードがあるとしましょう
src
|-main
|-webapp
|-jsp
| |-thing1.jsp
| |-thing2.jsp
|-WEB-INF
|-web.xml
その pom.xml は次のようになります。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo.bar.baz</groupId>
<artifactId>big-messy-ui</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
UI プロジェクトに Maven をインストールしたら、次のようにアプリケーションに含めることができます。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo.bar.baz</groupId>
<artifactId>some-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<!-- include ui as an overlay -->
<dependency>
<groupId>foo.bar.baz</groupId>
<artifactId>big-messy-ui</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<finalName>SomeApp</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
これで、 の war ファイルにSomeAppは、ローカル プロジェクトに含まれるものすべてと、インポートした乱雑な UI のすべてが含まれます。
SomeApp.war:
jsp
|-thing1.jsp // from overlay
|-thing2.jsp // from overlay
|-plus anything from SomeApp's src/main/webapp/jsp
META-INF
|-MANIFEST.MF
WEB-INF
|-classes
| |-.class files from SomeApps's src/main/java
|-web.xml (from SomeApp, the web.xml from the overlay is dropped)