親モジュールと 2 つの子を持つ Maven プロジェクトがあります:Service
とAPI
. Service
モジュールは WAR であり、プロジェクトのすべてのソース ファイルが含まれていますが、モジュールAPI
は純粋に Service モジュールのクラスのサブセットを含む jar を構築し、その jar をローカルの Maven リポジトリにデプロイするために存在します。
と の組み合わせを試してmaven-dependency-plugin
、戦争maven-assembly-plugin
をコピーして展開されたJAR に含めましたが、サービス モジュールから特定のクラスのセットだけを取り込む方法を見つけるのに苦労しています。太った戦争。Service
API
API
の pom.xmlから:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeGroupIds>...</excludeGroupIds>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
maven-jar-plugin
モジュールの pom を使用してスリム JAR をビルドすることを考えましたService
が、これは悪い習慣のようです。提案?