Need help understanding how a build.xml file works



Forewarning: I'm not very bright so the question may seem extremely idiotic.


I need to make an ant file that will compile my source files to a target directory. In addition, it needs to test all the JUnit files in my project.


However, I understand next to nothing in a build.xml. At the moment I have my project folder in eclipse contain two separate package folders that hold all my java files.


Would the following be along the right path?



<project name="PersonPersistence" default="compile" basedir=".">

<target name="compile" description="Compiles java source files.">
<mkdir dir="target"/>
<javac srcdir="src" destdir="target"/>
</target>

<target name="test" depends="compile" description="Tests JUnit files.>
<java jar="src/packOne/Test1.java"/>
</target>

</project>


Or do I need to do something else for the "test" portion? Such as putting all my test files into a jar file?


No comments:

Post a Comment