Mavenアセンブリプラグインを使用してjarをビルドできます。
まず、結果のjarを実行可能にするために、pom.xmlプラグインセクションにいくつかの情報を追加する必要があります。
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.example.installer.Installer</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
別のアセンブリ記述子を使用して、実際のインストーラーjarをビルドすること
をお勧めします。次に例を示します。
<assembly>
<id>installer</id>
<formats>
<format>jar</format>
</formats>
<baseDirectory></baseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<includes>
<!-- this references your installer sub-project -->
<include>com.example:installer</include>
</includes>
<!-- must be unpacked inside the installer jar so it can be executed -->
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
<dependencySet>
<outputDirectory>/</outputDirectory>
<includes>
<!-- this references your server.war and any other dependencies -->
<include>com.example:server</include>
</includes>
<unpack>false</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
アセンブリ記述子を「installer.xml」として保存した場合は、次のようにアセンブリを実行してjarをビルドできます。
mvn clean package assembly:single -Ddescriptor = installer.xml
お役に立てれば。役立つと思われる追加のリンクを次に示します。