1 | <project name="SimpleApp" default="exe" basedir=".">
|
---|
2 | <property name="src" location="src" />
|
---|
3 | <property name="lib" location="lib" />
|
---|
4 | <property name="build" location="build" />
|
---|
5 | <property name="launch4j.dir" location="../.." />
|
---|
6 |
|
---|
7 | <path id="dist.classpath">
|
---|
8 | <pathelement path="${build}" />
|
---|
9 | <fileset dir="${lib}">
|
---|
10 | <include name="**/*.jar" />
|
---|
11 | </fileset>
|
---|
12 | </path>
|
---|
13 |
|
---|
14 | <target name="init">
|
---|
15 | <tstamp />
|
---|
16 | <mkdir dir="${build}" />
|
---|
17 | </target>
|
---|
18 |
|
---|
19 | <target name="compile" depends="init" description="compile the source">
|
---|
20 | <javac srcdir="${src}" destdir="${build}" classpathref="dist.classpath" source="1.4" debug="on" />
|
---|
21 | </target>
|
---|
22 |
|
---|
23 | <target name="jar" depends="compile" description="create the jar">
|
---|
24 | <fileset dir="${lib}" id="lib.dist.fileset">
|
---|
25 | <include name="**/*.jar" />
|
---|
26 | </fileset>
|
---|
27 | <pathconvert pathsep=" " property="dist.classpath" refid="lib.dist.fileset">
|
---|
28 | <map from="${lib}" to=".\lib" />
|
---|
29 | </pathconvert>
|
---|
30 | <!-- Put everything in ${build} into a jar file -->
|
---|
31 | <jar jarfile="${ant.project.name}.jar">
|
---|
32 | <fileset dir="${build}" includes="**/*" />
|
---|
33 | <manifest>
|
---|
34 | <!-- SET YOUR MAIN CLASS HERE -->
|
---|
35 | <attribute name="Main-Class" value="net.sf.launch4j.example.SimpleApp" />
|
---|
36 | <attribute name="Class-Path" value=". ${dist.classpath}" />
|
---|
37 | </manifest>
|
---|
38 | </jar>
|
---|
39 | </target>
|
---|
40 |
|
---|
41 | <target name="exe" depends="jar">
|
---|
42 | <taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar
|
---|
43 | :${launch4j.dir}/lib/xstream.jar" />
|
---|
44 | <launch4j configFile="./l4j/SimpleApp.xml" />
|
---|
45 | </target>
|
---|
46 |
|
---|
47 | <target name="clean" description="clean up">
|
---|
48 | <delete dir="${build}" />
|
---|
49 | <delete file="${ant.project.name}.jar" />
|
---|
50 | <delete file="${ant.project.name}.exe" />
|
---|
51 | </target>
|
---|
52 | </project>
|
---|