2016-09-20 57 views
1

我的目标是自动将独立JRE与我的Java应用程序一起通过Maven封装。适用于Java应用程序的JRE包装

为了达到这个目的,我使用了JDK的exec-maven-pluginjavapackager。我的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打包到目标目录中。

回答

0

,如果你想在底座JRE添加到您的捆绑使用的部份

<argument>-Bruntime</argument> 
<argument>${env.JAVA_HOME}</argument> 

-srcdir是你的所有相关文件的目录,所以我只需1排除-srcdir和使用-srcfiles

如果你不想要,添加一个path.separator到它的末尾

相关问题