help fixing an ant build for java
I was trying to building a java project with a run function. Problem is, the build file is located at the base directory and file with the main method is in the /contents/username/ subdirectory - I can't seem to properly call the file even though when I run Ant compile, the .java with the main method is compiled without a problem
<project name="build" default="compile">
<target name="compile" depends="clean">
<javac srcdir="." includeantruntime="false"/>
</target>
<target name="clean">
<delete>
<fileset dir="." includes="**/*.class"/>
<fileset dir="." defaultexcludes="no" includes="**/*~"/>
</delete>
<delete dir="META-INF" failonerror="false"/>
</target>
<target name="run" depends="compile, who">
<java classname="Driver" classpath="./contents/username" fork="yes"/>
</target>
<target name="who">
<echo message="Written by ****, is that a good thing?"/>
</target>
<target name="jar">
<jar destfile="./username.jar">
<fileset dir="." includes="**/*.java, build.xml"/>
</jar>
</target>
</project>
Related Article: Reading an ant script
is a solved Java discussion thread by shack99 that has 1 reply and was last updated 1 year ago.
Goldfinch
Junior Poster in Training
55 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
I'm not sure if it's polite to post my own solution before I hear from anyone else, but I found a solution that works. Replace line 15 with:
<java classname="contents.username.Driver" fork="yes"/>
Goldfinch
Junior Poster in Training
55 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0