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

Ant Basic Doubt

 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a tutorial

Let's create another build file and examine some common command line options in ant. Copy the following lines into a file named "echo.xml".



Execute ant using:

* -f echo.xml to specify "echo.xml" as the build file
* goodbye to specify "goodbye" as the target rather than the default


Question:

My Ant directory is in C drive. with ant batch file in "C:\ant\bin"
As told in the tutorial I saved this xml as "echo.xml" in "C:\ant\bin" and I didn't understand this part.




Execute ant using:

* -f echo.xml to specify "echo.xml" as the build file
* goodbye to specify "goodbye" as the target rather than the default



Actually where should I include this [ -f echo.xml ]. Should I include this in the ant batch file.

One more doubt is How to store these xml files in different folders and execute the ant batch file without errors. I tried by putting a xml file in another folder and got error when executed the ant batch file as

C:\ant\bin>
Buildfile: build.xml does not exist!
Build failed

Some one please help me.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Execute ant using:

* -f echo.xml to specify "echo.xml" as the build file
* goodbye to specify "goodbye" as the target rather than the default


That refers to command line options.
The -f switch lets you specify the build file to be used; if you omit it, Ant defaults to using "build.xml" , and will complain if it doesn't exist.
The other parameter is the target to be executed. You have two, hello and goodbye. If you omit it, the default is "hello", because that is specified in the <project> element. (The Ant manual talks about all of this in detail.)
So what you might type in is as follows:
ant -f echo.xml
ant -f echo.xml goodbye

As an aside, you should not store any build files in the bin directory. Add the bin directory to your PATH, so that you can access ant from any directory.
[ July 25, 2005: Message edited by: Ulf Dittmer ]
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That worked

thank u very much




 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic