PackPartitions now builds a 'fat' jar file containing all classes and dependent libraries.

This commit is contained in:
Martin Haye 2016-02-01 08:07:12 -08:00
parent 10db0b073a
commit 8439e6840d
3 changed files with 15 additions and 64 deletions

View File

@ -10,64 +10,15 @@
<project name="PackPartitions" default="default" basedir=".">
<description>Builds, tests, and runs the project PackPartitions.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="PackPartitions-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
<target name="-post-jar">
<echo message="Packaging ${application.title} into a single JAR at ${dist.jar}"/>
<move file="${dist.jar}" tofile="dist/${application.title}-thin.jar"/>
<jar jarfile="${dist.jar}">
<zipfileset src="dist/${application.title}-thin.jar" />
<zipgroupfileset dir="dist/lib" includes="*.jar" excludes="META-INF/*"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
</target>
</project>

View File

@ -1,6 +1,6 @@
build.xml.data.CRC32=69409762
build.xml.script.CRC32=89726637
build.xml.stylesheet.CRC32=8064a381@1.68.1.46
build.xml.data.CRC32=f3c1938b
build.xml.script.CRC32=c226afaf
build.xml.stylesheet.CRC32=8064a381@1.75.2.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=69409762

View File

@ -33,7 +33,7 @@ file.reference.acme.jar=../ACME/src/acme.jar
file.reference.lz4-1.1.1.jar=/Users/mhaye/LL/repo/Platform/Apple/tools/PackPartitions/lib/lz4-1.1.1.jar
file.reference.plasm.jar=../PLASMA/src/plasm.jar
includes=**
jar.compress=false
jar.compress=true
javac.classpath=\
${file.reference.lz4-1.1.1.jar}:\
${libs.groovy-all.classpath}:\