私はいくつかのバイナリを生成する必要があるmavenプロジェクトを持っています。それらのうちのいくつかは依存関係を持たず、依存関係はバイナリごとに異なる場合があります。Mavenプロジェクトの複数のバイナリに対する依存関係の違い
質問は次のとおりです。どのようにすべての依存関係を含むことなく、すべての瓶に必要なものだけを含めることでこれを達成できますか?
現在、すべてのjarファイルにすべての依存関係を置くことを除いて、ジョブを実行するアセンブリプラグインを使用しています。さらに、私は必要のない標準のapp1-snapshot jarを作成します。どうすればそれを取り除くことができますか?
マイポンポンファイル:
<?xml version="1.0" encoding="UTF-8"?>
<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>antlrtest</groupId>
<artifactId>app1</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>thf_test</id>
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>parsers.THF_test</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>bin/THF_test</finalName>
</configuration>
</execution>
<execution>
<id>hmf_test</id>
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>parsers.HMF_test</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>bin/HMF_test</finalName>
</configuration>
</execution>
<execution>
<id>HMF_to_THF</id>
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>transformation.HMF_to_THF</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>bin/HMF_to_THF</finalName>
</configuration>
</execution>
</executions>
</plugin>
<!-- antlr -->
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.5</version>
<configuration>
<arguments>
<argument>-package</argument>
<argument>parsers</argument>
</arguments>
</configuration>
<executions>
<execution>
<id>antlr</id>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.5</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
http://stackoverflow.com/questions/2424015/maven-best-practice-for-generating-multiple-jars-with-different-filtered-classesに関連する(しかし重複しない) – YMomb