This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes how to pass command line parameters in calling  ant file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "how to pass command line parameters in calling  ant file" Watch "how to pass command line parameters in calling  ant file" New topic
Author

how to pass command line parameters in calling ant file

Ketan Parekh
Greenhorn

Joined: Sep 15, 2005
Posts: 20
Hi All, I m using a Build file which calls another build file.

That build file is run from the command prompt by give ant -lib <path of jars it needs for executing>.

Now i m calling this file from main build file but it does not work as i m not able to set <b>-lib </b>.

Pls can anybody let me know how to set such command line parameters to call the build file in ant script.

Thanks in Advance.

Ketan.B.Parekh
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41034
    
  43
The following shows how to define a classpath, and use it in invocation of the java process:


Ping & DNS - my free Android networking tools app
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
If lib is your only problem then you can set the lib with standard -lib option while calling the new main build file. The forked/subprocess shares the caller's environment and should not be the problem. If you have additional parameter then you need to pass through properties from the caller. I am sure the child process assigns the command line parameter to a property and all you need to do is pass those properties. Take a look at the "ant" task in the below link
http://ant.apache.org/manual/CoreTasks/ant.html
Ketan Parekh
Greenhorn

Joined: Sep 15, 2005
Posts: 20
Thanks Buddy i will try it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to pass command line parameters in calling ant file
 
Similar Threads
Ant and its verion
Deploying With Ant Using Websphere3.5
Parameters in Java task
Ant beginner, having problems
build.xml question