Thursday, March 8, 2012

How to make build.xml file?


1. Right click on the project
2. Go to the new>>file gives the filename as build.xml

Eg:
<project name="MyProject" default="usage" basedir=".">
<description>
     creating the simple build xml file
</description>
<!-- Set global property for this build file -->
<property name="src" value="${basedir}"/>
  <property name="jar" value="C:/Selenium/Jar file"/>
  <property name="build" value="build"/>
<!---Creating the Init Target>
<target name="init" >
<!--create timestamp--->
<tstamp/>
<!--create the build directory-->
<mkdir dir="${"build"}"/>
</target>
<!---Creating the Compile Target>
<target name="compile" depends="init" >
<!--compile the java source code from src to build dir--->
<javac srcdir="${"src"}" destdir="${"build"}"/>
</target>

<!---Creating the Dist Target>
<target name="dist" depends="compile" >
<mkdir dir="${"dist"}/lib"/>
<!---Put everything in ${build} into the myproject >
<jar jarfile="${"dist"}/lib/${ant.project.name}-${DSTAMP.jar}" basedir="${C:/project}"/>
</target>
<!---Creating the Clean Target>
<target name="clean" >
<delete dir="${"build"}"/>
<delete dir="${"dist"}"/>
</target>
</project>



  

No comments:

Post a Comment