2016-09-20 4 views
1

私の目標は、自動的に、Mavenのを経由して自分のJavaアプリケーションと一緒に、スタンドアロンのJREをパッケージ化することです。パッケージJREは、Javaアプリケーションのための

これを達成するために、私は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

あなたのバンドルの使用THS

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

-srcdirに基本JREを追加したい場合は、すべての依存ファイルのディレクトリなので、あなただけの1が-srcdirを除外し、-srcfiles

を使用する必要がありますIあなたは、それの最後にpath.separatorを追加したいいけない場合

関連する問題