Skip to content

Instantly share code, notes, and snippets.

@Rio6
Last active March 15, 2020 00:34
Show Gist options
  • Save Rio6/1d27815a5c7c74b062c8b763290ca671 to your computer and use it in GitHub Desktop.
Save Rio6/1d27815a5c7c74b062c8b763290ca671 to your computer and use it in GitHub Desktop.
ant build.xml template
<project name="Name" default="dist" basedir=".">
<description>
Description
</description>
<property name="version" value="0.1" />
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property name="lib" location="lib" />
<property name="res" location="res" />
<path id="classpath">
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
</path>
<target name="compile">
<mkdir dir="${build}" />
<depend srcdir="${src}" destdir="${build}" cache="depcache" closure="yes"/>
<javac srcdir="${src}" destdir="${build}" classpathref="classpath" includeantruntime="false"/>
</target>
<target name="dist" depends="compile">
<mkdir dir="${dist}"/>
<manifest file="${build}/MANIFEST.MF">
<attribute name="Main-Class" value="package.MainClass" />
</manifest>
<jar jarfile="${dist}/${ant.project.name}-${version}.jar"
manifest="${build}/MANIFEST.MF">
<fileset dir="${build}" />
<fileset dir="${src}" includes="**/*.java"/>
<fileset dir="${res}" includes="*.yml"/>
</jar>
</target>
<target name="clean">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment