I couldn't find any maven plugin for this either.
There is version 1.2 of packr in maven central, but bear in mind this is now a fairly old version (https://github.com/libgdx/packr/issues/58).
You can use the standard exec-maven-plugin to draw upon the packr 1.2 dependency and then run it (see http://www.mojohaus.org/exec-maven-plugin/examples/example-exec-using-plugin-dependencies.html).
The relevant fragment in the pom.xml build file might look something like:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.badlogicgames.packr/packr -->
<dependency>
<groupId>com.badlogicgames.packr</groupId>
<artifactId>packr</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>package-native-windows</id>
<phase>package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<executableDependency>
<groupId>com.badlogicgames.packr</groupId>
<artifactId>packr</artifactId>
</executableDependency>
<mainClass>com.badlogicgames.packr.Packr</mainClass>
<arguments>
<argument>packr-windows-config.json</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
If you've already got a <build>
and <plugins>
section in your pom.xml, then just take the <plugin>
bit and put it in there.
The json config file might look something like:
{
"platform": "windows",
"jdk": "jre-8u102-windows-x64.zip",
"executable": "MyApp",
"appjar": "target/MyApp-jar-with-dependencies.jar",
"classpath": [ "MyApp-jar-with-dependencies.jar" ],
"mainclass": "com.foo.MyAppMain",
"outdir": "target/native-windows"
}
One thing to be aware of, packr 1.2 seems to delete the 'outdir' directory, so be careful to use something other than the 'target' directory.
In case it helps, I personally ended up packaging for windows using launch4j with the launch4j-maven-plugin and packaging for linux/mac using Oracle's standard javapackager tool via the javafx-maven-plugin. I'd link to those two but StackOverflow tells me I don't have enough rep to include more than two links.