1
我的目标是自动将独立JRE与我的Java应用程序一起通过Maven封装。适用于Java应用程序的JRE包装
为了达到这个目的,我使用了JDK的exec-maven-plugin
和javapackager
。我的POM的设置是这样的:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>package-jar2</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>
${env.JAVA_HOME}/bin/javapackager
</executable>
<arguments>
<argument>-deploy</argument>
<argument>-native</argument>
<argument>exe</argument>
<argument>-appclass</argument>
<argument>${app.main.class}</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}</argument>
<argument>-srcfiles</argument>
<argument>${project.build.directory}\${artifactId}-${version}.jar</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}</argument>
<argument>-outfile</argument>
<argument>${project.artifactId}-${version}</argument>
<argument>-v</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
最后,javapackager
发出以下错误:
[INFO] --- exec-maven-plugin:1.5.0:exec (package-jar2) @ cli-api ---
Error: Unknown argument: D:\Archiv\Dokumente\Entwicklung\PEProjekt\repository\core\cli-api\target
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: -1 (Exit value: -1)
的Unknown argument
似乎是我-srcdir
参数。
我在做什么错?我想将我的本地JRE打包到目标目录中。