Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update build file to build a jar with manifest.

  • Loading branch information...
commit cf6601dde523e0d6bfae968132be9d278d0ee3da 1 parent b75da9e
Stuart Childs authored

Showing 1 changed file with 46 additions and 40 deletions. Show diff stats Hide diff stats

  1. +46 40 build.xml
86 build.xml
... ... @@ -1,44 +1,50 @@
1 1 <project default="build">
2   - <property name="src.dir" value="src" />
3   - <property name="lib.dir" value="lib" />
4   - <property name="build.dir" value="build" />
5   - <property name="classes.dir" value="${build.dir}/classes" />
6   - <property name="jars.dir" value="${build.dir}/jars" />
7   - <property name="dist.name" value="classproject.jar" /> <!--This is the name of our distribution file -->
  2 + <property name="src.dir" value="src"/>
  3 + <property name="lib.dir" value="lib"/>
  4 + <property name="build.dir" value="build"/>
  5 + <property name="classes.dir" value="${build.dir}/classes"/>
  6 + <property name="jars.dir" value="${build.dir}/jars"/>
  7 + <property name="dist.name" value="classproject.jar"/>
  8 + <!--This is the name of our distribution file -->
8 9
9   - <property name="junit.jar" value="${lib.dir}/junit4.8.2/junit-4.8.2.jar" />
10   - <property name="classpath" value="${junit.jar}" />
11   -
12   - <target name="clean" description="Erase all generated files">
13   - <delete dir="${build.dir}" failonerror="true" />
14   - </target>
  10 + <property name="junit.jar" value="${lib.dir}/junit4.8.2/junit-4.8.2.jar"/>
  11 + <property name="classpath" value="${junit.jar}"/>
15 12
16   - <target name="compile">
17   - <mkdir dir="${classes.dir}" />
18   - <javac srcdir="${src.dir}" destdir="${classes.dir}" classpath="${classpath}" />
19   - </target>
20   -
21   - <target name="test" depends="compile">
22   - <junit haltonfailure="true">
23   - <classpath path="${junit.jar};${classes.dir}" />
24   - <formatter type="brief" usefile="false" />
25   - <batchtest>
26   - <fileset dir="${src.dir}">
27   - <include name="**/*Test*.java" />
28   - </fileset>
29   - </batchtest>
30   - </junit>
31   - </target>
32   -
33   - <target name="build" depends="test" description="Full build and test">
34   - </target>
35   -
36   - <target name="jar" depends="build">
37   - <mkdir dir="${jars.dir}" />
38   - <jar destfile="${dist.name}" basedir="${classes.dir}" />
39   - </target>
40   -
41   - <target name="release" depends="clean, jar" description="Create release package">
42   - <copy file="${dist.name}" todir="${build.dir}" />
43   - </target>
  13 + <target name="clean" description="Erase all generated files">
  14 + <delete dir="${build.dir}" failonerror="true"/>
  15 + </target>
  16 +
  17 + <target name="compile">
  18 + <mkdir dir="${classes.dir}"/>
  19 + <javac srcdir="${src.dir}" destdir="${classes.dir}" classpath="${classpath}"/>
  20 + </target>
  21 +
  22 + <target name="test" depends="compile">
  23 + <junit haltonfailure="true">
  24 + <classpath path="${junit.jar};${classes.dir}"/>
  25 + <formatter type="brief" usefile="false"/>
  26 + <batchtest>
  27 + <fileset dir="${src.dir}">
  28 + <include name="**/*Test*.java"/>
  29 + </fileset>
  30 + </batchtest>
  31 + </junit>
  32 + </target>
  33 +
  34 + <target name="build" depends="test" description="Full build and test">
  35 + </target>
  36 +
  37 + <target name="jar" depends="build">
  38 + <mkdir dir="${jars.dir}"/>
  39 + <jar destfile="${dist.name}" basedir="${classes.dir}">
  40 + <manifest>
  41 + <attribute name="Main-Class"
  42 + value="com.example.classproject.HelloWorld"/>
  43 + </manifest>
  44 + </jar>
  45 + </target>
  46 +
  47 + <target name="release" depends="clean, jar" description="Create release package">
  48 + <copy file="${dist.name}" todir="${build.dir}"/>
  49 + </target>
44 50 </project>

0 comments on commit cf6601d

Please sign in to comment.
Something went wrong with that request. Please try again.