Skip to content

Instantly share code, notes, and snippets.

@Benehiko
Created April 4, 2018 23:54
Show Gist options
  • Save Benehiko/540b7706f9ea890ac99ded9f6972413d to your computer and use it in GitHub Desktop.
Save Benehiko/540b7706f9ea890ac99ded9f6972413d to your computer and use it in GitHub Desktop.
Compile dependencies into a fat jar
<target name="package-for-store" depends="jar">
<property name="store.jar.name" value="myProject"/> <!--CHANGE VALUE TO PROJECT NAME-->
<property name="store.dir" value="store"/>
<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
<echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
<delete dir="${store.dir}"/>
<mkdir dir="${store.dir}"/>
<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
<zipgroupfileset dir="dist" includes="*.jar"/>
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
<zip destfile="${store.jar}">
<zipfileset src="${store.dir}/temp_final.jar"
excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
</zip>
<delete file="${store.dir}/temp_final.jar"/>
</target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment