Maven と launch4j を使用して、Java ベースのコマンド ライン アプリとそのすべての依存関係を単一の *.exe ファイルにラップしたいと考えています。
今、私はこれとこれのようなSOに関するすべての同様の質問を読みましたが、うまくいきません。
誰でも単純な pom.xml スニペットを提供できますか?必要なすべての依存関係でこれを実現する方法。ところで、Eclipse の実行構成でどの Maven ビルド目標を実行する必要がありますか?
SOからコピーしたものは次のとおりです。
<!-- Launch4j -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached> <!-- Make the shaded artifact not the main one -->
<shadedClassifierName>shaded</shadedClassifierName> <!-- set the suffix to the shaded jar -->
</configuration>
</plugin>
<plugin>
<groupId>org.bluestemsoftware.open.maven.plugin</groupId>
<artifactId>launch4j-plugin</artifactId>
<version>1.5.0.0</version>
<executions>
<!-- Command-line exe -->
<execution>
<id>l4j-cli</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>console</headerType>
<outfile>target/importer.exe</outfile>
<jar>target/${artifactId}-${version}-shaded.jar</jar> <!-- 'shaded' is the value set on shadedClassifierName above -->
<errTitle>App Err</errTitle>
<classPath>
<mainClass>${mainClass}</mainClass>
</classPath>
<jre>
<minVersion>1.5.0</minVersion>
<maxVersion>1.6.0</maxVersion>
<initialHeapSize>128</initialHeapSize>
<maxHeapSize>1024</maxHeapSize>
</jre>
</configuration>
</execution>
</executions>
</plugin>
Eclipse でlaunch4j:launch4jゴールを実行すると(これが正しい場合は?)、次のようになります。
プロジェクト インポーターでゴール org.bluestemsoftware.open.maven.plugin:launch4j-plugin:1.5.0.0:launch4j (default-cli) を実行できませんでした: ゴール org.bluestemsoftware.open.maven のパラメーター 'headerType'、'jre' .plugin:launch4j-plugin:1.5.0.0:launch4j が見つからないか無効です -> [ヘルプ 1]
たぶん、私は偽の目標を立ち上げているだけです...