I followed this tutorial. And i have build a class in /WEB-INF/classes”.
I have build file with content below :
<target name="build" description="Compile main source tree java files">
<mkdir dir="${build.dir}"/>
<javac destdir="${build.dir}" source="1.5" target="1.5" debug="true"
deprecation="false" optimize="false" failonerror="true">
<src path="${src.dir}"/>
<classpath refid="master-classpath"/>
</javac>
</target>
but now i just clean,do not build again,
<?xml version="1.0"?>
<project name="fax" basedir="." default="build">
<property name="src.dir" value="src"/>
<property name="web.dir" value="war"/>
<property name="build.dir" value="${web.dir}/WEB-INF/classes"/>
<property name="name" value="fax"/>
<path id="master-classpath">
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${build.dir}"/>
</path>
<target name="build" description="Compile source tree java files">
</target>
<target name="clean" description="Clean output directories">
<delete>
<fileset dir="${build.dir}">
<include name="**/*.class"/>
</fileset>
</delete>
</target>
</project>
but unfortunately,when i type “ant”, it give me “Build successful” message, but this file was not deleted ? Anybody tell me what wrong here? thanks
When you type “ant” default target gets executed and your default target is “build” as defined in the first line of your ant xml
To clean, either use: “ant clean” or change the default target from build to clean. But I think you might want to keep the default target to build and invoke clean separately.
Other alternate is to use dependency of targets. I.e. you can automatically invoke clean target before the build target.
To do this, change the build target tag by adding a depends attribute to it as follows:
< target name=”build” description=”Compile source tree java files” depends=”clean”>