Site icon NgDeveloper

Ant (configuration and My First Ant)

Step 1: Set the environment variables as follows,
Start -> My Computer -> Rightclick on it and click properties -> Advanced System Settings-> Advanced -> Environmental variables -> create new on the user variables and type,
1. Variable Name: JAVA_HOME Variable value: jdk path.(say C:\Program Files\Java\jdk1.7.0)
2. Variable Name: ANT_HOME Variable Value: Ant path (say C:\Apache Ant 1.7.1)
3. Variable Name: Path Variable Value: Ant path;Jdk path (say C:\Apache Ant 1.7.1\bin;C:\Program Files\Java\jdk1.7.0\bin;)
Note: In the JAVA_HOME and ANT_HOME path should be without bin, but in the path till the bin we have to mention.
Step 2: Create a xml file named build.xml and copy the below things in the file,
<?xml version=”1.0″ encoding=”UTF-8″?>
<project name=”MyFirstAnt” default=”checkout” basedir=”.”>
<property file=”build.properties” />
<target name=”checkout” >
<exec executable=”svn” dir=”${src.dir}”>
<arg line=” co –username (mention the username) –password (mention the password) Repository name (say http://xx.yy.zz.aa/repo ${src.dir}/guru “/>
</exec>
</target>
</project>
Step 3: create a property file named build.properties and mention what is src.dir in that,
example: src.dir=C:/Users/311751/Desktop/Raghavendra
Note: property file is basically used to mention the paths. This will be accessed in the build.xml by expression language. say (${src.dir}).
Instead of creating property file to mention the paths we can mention directly in the xml file itself as like follows,
<property name=”src.dir” value=”C:/Users/311751/Desktop/Raghavendra”>
Step 4: create a folder named cognizant in the desktop and paste both build.xml and build.properties file in it.
Step 5: Open the command prompt and go to the cognizant folder location,
example: c:\Users\311751\Desktop\cognizant
and type “ant” to run the ant.
then it starts to checkout the files from the mentioned repository to guru folder inside Raghavendra folder (desktop).
Revert me if you face any problems.
 
Thanks for reading this post…!!
Exit mobile version