Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To Run build.xml?

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have installed the Ant in my machine. And I have
set ANT_HOME=C:\apache-ant-1.5.3-1
set JAVA_HOME=C:\j2sdk1.4.1_02
set PATH=%PATH%;%ANT_HOME%/bin
There is a build.xml file bundled with an application that I have downloaded over the internet. How do I run this build.xml file?
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ant <yourTarget>
if you have a different XML file with targets, you can use:
ant -f <yourXMLFile> <yourTarget>
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please bear with me. What is MyXMLFile? What is MyTarget? And where should I type the command "ant <MyTarget>"?
The location of this build.xml is located in the NameOfTheApplication/WEB-INF/src folder. It is an application with lots of servlets, jsps, xml files, and property files in different directories.
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for confusing you
let's start from the beginning. If you located your build.xml file, open it.
you usually have many targets in your file, such as:

This is only an example, notice that you can have many targets. If you can identify one target from your XML file, you can execute it by using:
ant <targetName>
So, I would do:
C:\>ant clean
this target will delete my directory report.
Now, when projects grow you might want to create separate build files, just to organize things better. you can have a build.xml, scripts.xml, reports.xml, etc.
if you do not specify anything (like ant clean), then ant will look for the default XML build file (build.xml). But, if you want to tell Ant to use a different file, you use the -f flag.
C:\>ant -f reports.xml clean
hope it helps
P.S. For simplicity, open a DOS prompt and locate the directory in which your build.xml is placed. In my example, I assumed that build.xml was in my C:\ root.
let us know how it goes
[ September 08, 2003: Message edited by: Andres Gonzalez ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic