Hello Readers..
In this blog I am giving an example that how can we create an build.xml file for performing clean,compile and run by using ANT.
<?xml version="1.0" encoding="UTF-8"?>
<project name="AntProject" basedir="." default="run">
<property name="src.dir" value="${basedir}" />
<property name="build.dir" value="${basedir}/build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="jar.dir" value="${build.dir}/jar" />
<target name="clean">
<delete includeemptydirs="true">
<fileset dir="${build.dir}">
<include name="**/*" />
</fileset>
</delete>
</target>
<target name="compile" depends="clean">
<echo message="inside compile" />
<mkdir dir="${build.dir}" />
<mkdir dir="${classes.dir}" />
<javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}" />
</target>
<target name="run" depends="compile">
<echo message="inside run" />
<java classname="AntPackage.AntClass">
<classpath path="${classes.dir}" />
</java>
</target>
</project>
Note:- This above mention build.xml code is based on my machine. You can make changes as per your requirement or convenience.
Please see more details for the above mention code you can visit my previous blog, after click on the below link-
ANT
0 Comment(s)