Skip to content

Instantly share code, notes, and snippets.

@bertrandmartel
Last active August 29, 2015 14:27
Show Gist options
  • Save bertrandmartel/f0870d6ecbbd1b06f8a4 to your computer and use it in GitHub Desktop.
Save bertrandmartel/f0870d6ecbbd1b06f8a4 to your computer and use it in GitHub Desktop.
[ ANT ] compile & archive with source attachment projects with source (/src) and libraries (/libs)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="build" name="compile-archive">
<property name="project-name" value="your-project-name"/>
<property name="version" value="1.0" />
<path id="master-classpath">
<fileset dir="${basedir}/libs">
<include name="*.jar"/>
</fileset>
</path>
<target name="compile" description="Compile source">
<mkdir dir="bin" />
<javac srcdir="src" includes="**" destdir="bin" >
<classpath refid="master-classpath"/>
</javac>
<copy todir="bin">
<fileset dir="src" />
</copy>
</target>
<target name="build" depends="compile">
<jar destfile="${basedir}/release/${project-name}-${version}.jar">
<fileset dir="${basedir}/bin" />
<zipgroupfileset dir="${basedir}/libs" includes="**/*.jar" />
<manifest>
<attribute name="Main-Class" value="fr.your.path.to.main.class.if.necessay"/>
</manifest>
</jar>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment