Automated the fat jar creation process.

- Added a modified version of JarSplice in the tools/ directory, which can run using system properties as well as the GUI.  The project is located here: https://github.com/itdelatrisu/JarSplicePlus
- To create a fat jar, execute the Maven goal "install -Djar".  The output file will be in the target/ directory and suffixed "-runnable".

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-01-12 21:05:58 -05:00
parent 4152af4977
commit 71f614c90a
3 changed files with 58 additions and 12 deletions

View File

@ -39,9 +39,11 @@ opsu! is distributed as a Maven project.
* To run the project, execute the Maven goal `compile exec:exec`. * To run the project, execute the Maven goal `compile exec:exec`.
* To create a single executable JAR file, execute the Maven goal * To create a single executable JAR file, execute the Maven goal
`package shade:shade`. Note that the LWJGL native libraries must be linked and `install -Djar`. This will link the LWJGL native libraries using a
distributed with this application; [JarSplice](http://ninjacave.com/jarsplice) [modified version](https://github.com/itdelatrisu/JarSplicePlus) of
is included in the tools directory to merge the files into a fat jar. [JarSplice](http://ninjacave.com/jarsplice), which is included in the
`tools` directory in both its original and modified forms. The resulting
file will be located in `target/opsu-${version}-runnable.jar`.
## Credits ## Credits
This software was created by Jeffrey Han This software was created by Jeffrey Han

62
pom.xml
View File

@ -10,12 +10,16 @@
<resources> <resources>
<resource> <resource>
<directory>res</directory> <directory>res</directory>
<excludes>
<exclude>**/Thumbs.db</exclude>
</excludes>
</resource> </resource>
</resources> </resources>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration> <configuration>
<source>1.7</source> <source>1.7</source>
<target>1.7</target> <target>1.7</target>
@ -39,26 +43,66 @@
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>
<configuration> <version>1.3.2</version>
<executable>java</executable> <executions>
<arguments> <execution>
<argument>-Djava.library.path="${project.build.directory}\natives"</argument> <id>run</id>
<argument>-cp</argument> <phase>compile</phase>
<classpath /> <goals>
<argument>itdelatrisu.opsu.Opsu</argument> <goal>exec</goal>
</arguments> </goals>
</configuration> <configuration>
<skip>${jar}</skip>
<executable>java</executable>
<arguments>
<argument>-Djava.library.path="${project.build.directory}\natives"</argument>
<argument>-cp</argument>
<classpath />
<argument>itdelatrisu.opsu.Opsu</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>jarsplice</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<workingDirectory>${basedir}/target</workingDirectory>
<arguments>
<argument>-jar</argument>
<argument>-Dinput="opsu-${project.version}.jar"</argument>
<argument>-Dmain="itdelatrisu.opsu.Opsu"</argument>
<argument>-Doutput="opsu-${project.version}-runnable.jar"</argument>
<argument>${basedir}/tools/JarSplicePlus.jar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration> <configuration>
<!--
<artifactSet> <artifactSet>
<excludes> <excludes>
<exclude>*:*:natives*</exclude> <exclude>*:*:natives*</exclude>
</excludes> </excludes>
</artifactSet> </artifactSet>
-->
<createDependencyReducedPom>false</createDependencyReducedPom> <createDependencyReducedPom>false</createDependencyReducedPom>
</configuration> </configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

BIN
tools/JarSplicePlus.jar Normal file

Binary file not shown.