Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <project name="CalcAnt" basedir="." default="main">
- <property name="build.dir" value="build"/>
- <property name="jar.dir" value="${build.dir}/jar"/>
- <property name="main.build.dir" value="build/main"/>
- <property name="main.src.dir" value="src"/>
- <property name="test.build.dir" value="build/test"/>
- <property name="test.src.dir" value="src/testing"/>
- <property name="main-class" value="CalcSimples.CalcSimple"/>
- <!--PATH LIB-->
- <path id="classpath.test">
- <pathelement location="lib/junit-4.11.jar"/>
- <pathelement location="lib/hamcrest-core-1.3.jar"/>
- <pathelement location="${main.build.dir}"/>
- </path>
- <!--CLEAN-->
- <target name="clean">
- <delete dir="${build.dir}"/>
- </target>
- <!--COMPILE-->
- <target name="compile">
- <mkdir dir="${main.build.dir}"/>
- <javac srcdir="${main.src.dir}" destdir="${main.build.dir}" includeantruntime="false"/>
- </target>
- <!--TEST-COMPILE-->
- <target name="test-compile" depends="compile">
- <mkdir dir="${test.build.dir}"/>
- <javac srcdir="${test.src.dir}" destdir="${test.build.dir}" includeantruntime="false">
- <classpath refid="classpath.test"/>
- </javac>
- </target>
- <!--TEST-->
- <target name="test" depends="test-compile">
- <junit printsummary="on" haltonfailure="yes" fork="true">
- <classpath>
- <path refid="classpath.test"/>
- <pathelement location="${test.build.dir}"/>
- </classpath>
- <formatter type="brief" usefile="false" />
- <batchtest>
- <fileset dir="${test.src.dir}" includes="**/*Test.java" >
- </fileset>
- </batchtest>
- </junit>
- </target>
- <!--CREATE JAR-->
- <target name="jar" depends="compile">
- <mkdir dir="${jar.dir}"/>
- <jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${main.build.dir}">
- <manifest>
- <attribute name="Main-Class" value="${main-class}"/>
- </manifest>
- </jar>
- </target>
- <!--RUN JAR-->
- <target name="run" depends="jar">
- <java jar="${jar.dir}/${ant.project.name}.jar" fork="true"/>
- </target>
- <!--CLEAN-BUILD-->
- <target name="clean-build" depends="clean,jar"/>
- <!--MAIN-->
- <target name="main" depends="clean,run"/>
- </project>
Add Comment
Please, Sign In to add comment