これには、maven jar&warプラグインの少し高度な使用が必要です。
JavaクラスといくつかのWEB-INF/アーティファクトを持つ最初のもの
これがメインのWARを表しているとしましょう。maven-war-pluginのオーバーレイ機能を使用するだけです。最も基本的な方法は、戦争の依存関係を指定することです。
<dependency>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}-service-impl</artifactId>
<version>${version}</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
そして、maven warプラグインに、この依存関係のアセットをメインの戦争(現在の場所)にマージするように指示します
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<dependentWarExcludes>WEB-INF/web.xml,**/**.class</dependentWarExcludes>
<webResources>
<resource>
<!-- change if necessary -->
<directory>src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
また、2番目のものへのjarタイプの依存関係を含めます(これはのJARになりますWEB-INF/lib/)
<dependency>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}-service</artifactId>
<version>${version}</version>
<type>jar</type>
</dependency>
また、3番目のWARからのクラスへの依存関係を指定する必要があります。
<dependency>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}-service-impl</artifactId>
<version>${version}</version>
<classifier>classes</classifier>
<type>jar</type>
</dependency>
分類子の注意、同じアーティファクトの2つの依存関係を指定しているため、必要です...それを機能させるには、分類子とその事実に関して、3番目のアーティファクト(warタイプのアーティファクト)にjarプラグインを設定する必要があります1つのアーティファクト(warとjar)から2つのパッケージが必要です。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<!-- jar goal must be attached to package phase because this artifact is WAR and we need additional package -->
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<!--
classifier must be specified because we specify 2 artifactId dependencies in Portlet module, they differ in type jar/war, but maven requires classifier in this case
-->
<classifier>classes</classifier>
<includes>
<include>**/**.class</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>