(Or things that may be changed/fixed as it moves out of SNAPSHOT status)
<plugin> <groupId>org.devzendo</groupId> <artifactId>cross-platform-launcher-plugin</artifactId> <configuration> <os>Windows</os> <applicationName>BeanMinder</applicationName> <mainClassName>org.devzendo.minimiser.MiniMiser</mainClassName> <systemProperties> <param>myWindowsProperty=foo</param> <!-- like -DmyWindowsProperty=foo --> <param>anotherWindowsProperty=bar</param> </systemProperties> <vmArguments> <param>-Xcheck:jni</param> <!-- passed straight through to the JVM --> <param>-enableassertions</param> <param>-verbose:jni</param> </vmArguments> </configuration> <executions> <execution> <id>createlauncher</id> <phase>generate-resources</phase> <goals> <goal>createlauncher</goal> </goals> </execution> </executions> </plugin>
See here for details; you must be using Maven 2.0.8 or greater.
e.g. parent pom:
<build> <pluginManagement> <plugins> <plugin> <groupId>org.devzendo</groupId> <artifactId>cross-platform-launcher-plugin</artifactId> <executions> <execution> <id>createlauncher</id> <phase>generate-resources</phase> <goals> <goal>createlauncher</goal> </goals> <configuration> <systemProperties> <param>commonProperty=xyz</param> <param>anotherCommonProperty=abc</param> </systemProperties> <vmArguments> <param>-Xmx1024</param> </vmArguments> </configuration> </execution> </executions> </plugin> </plugins> </pluginManagement> </build>
And in the child pom:
<build> <plugins> <plugin> <groupId>org.devzendo</groupId> <artifactId>cross-platform-launcher-plugin</artifactId> <configuration> <os>MacOSX</os> <applicationName>BeanMinder</applicationName> <mainClassName>org.devzendo.minimiser.MiniMiser</mainClassName> <iconsFileName>BeanMinder.icns</iconsFileName> <systemProperties combine.children="append"> <param>myMacOsXProperty=foo</param> <param>anotherMacOsXProperty=bar</param> </systemProperties> <vmArguments combine.children="append"> <param>-Xcheck:jni</param> <!-- debug JNI on Mac OS X --> </vmArguments> </configuration> <executions> <execution> <id>createlauncher</id> <phase>generate-resources</phase> <goals> <goal>createlauncher</goal> </goals> </execution> </executions> </plugin> ...
Then specify the relevant AOL-classifier:type narClassifier parameters in your pom.xml so that the CrossPlatformLauncherPlugin copies the relevant JNI files into the launcher's library directory appropriately.
See the NAR Example for a worked example.
<!-- janelType must be used before v0.2.1 of the plugin --> <janelType>Console</janelType> <!-- or --> <janelType>GUI</janelType> <!-- In v0.2.1, janelType must be changed to launcherType --> <launcherType>Console</launcherType> <!-- or --> <launcherType>GUI</launcherType>
<janelCustomLines> <param>janel.min.java.version=1.4</param> <param>janel.max.java.version=1.5</param> </janelCustomLines>
<configuration> <os>MacOSX</os> <applicationName>BeanMinder</applicationName> <mainClassName>org.devzendo.minimiser.MiniMiser</mainClassName> <iconsFileName>BeanMinder.icns</iconsFileName>
You need to add a dependency on the Java portion of them, (possibly in a profile that's only activated on Mac OS X), and extract the native portion of them into the correct place in your launcher .app directory structure using the Maven dependency plugin:
<dependencies> ... <dependency> <groupId>org.devzendo</groupId> <!-- Note that this uses DevZendo.org's Maven packaging of Quaqua --> <artifactId>quaqua</artifactId> <!-- The Java portion --> <version>9.1</version> </dependency> </dependencies> <build> <plugins> <!-- Create the Mac OS X BeanMinder.app launcher structure under target/macosx. --> ... <!-- Copy the Quaqua native libraries into the correct location in the Mac OS X launcher structure created above. --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>unpack-dependencies</id> <phase>package</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.devzendo</groupId> <artifactId>libquaqua</artifactId> <version>9.1</version> <!-- The JNI libraries --> <type>zip</type> <overWrite>true</overWrite> <includes>*</includes> <outputDirectory>${project.build.directory}/macosx/BeanMinder.app/Contents/Resources/Java/lib</outputDirectory> </artifactItem> </artifactItems> <!-- other configurations here --> </configuration> </execution> </executions> </plugin> <!-- Package up the above .app structure into a .tar.gz archive --> ... </plugins> </build>
<launcherType>Console</launcherType> <!-- or --> <launcherType>GUI</launcherType>
<stubType>Universal</stubType>