My goal is to to package a standalone JRE alongside with my Java application via Maven, automatically.
In order to achieve this, I use exec-maven-plugin
and javapackager
from JDK. My POM setting looks like this:
<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>
Finally, the javapackager
emits following error:
[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)
The Unknown argument
seems to be my -srcdir
parameter.
What am I doing wrong? I'd like to package my native JRE in target directory.