You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ben Stover <bx...@yahoo.co.uk> on 2008/10/31 19:52:07 UTC

How to pass a file to an Ant build.xml process from command line?

Normally I use Ant by clicking on a pre-defined build.xml process inside e.g. Eclipse.

However sometimes I would appreciate to have the chance to call Ant and an Ant build.xml script
from command line and pass e.g. a file to it. Something like:

java org.apache.ant.executescript D:\myproj\tbuild.xml D:\myproj\test222\somefile.java

Can I do this somehow?

If yes: how exactly would the command lokk like and how would I refer 
to the passed file (=parameter) from inside build.xml?

Ben







---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: How to pass a file to an Ant build.xml process from command line?

Posted by Morgan Kinne <ki...@us.ibm.com>.
First on the command line try:
ant -help

This will show you the command line options. You will notice:
ant -buildfile  myfavoritebuildfile.xml

is the option you are looking for.
Morgan



From:
"Ben Stover" <bx...@yahoo.co.uk>
To:
"Ant Users List" <us...@ant.apache.org>
Date:
10/31/2008 02:55 PM
Subject:
How to pass a file to an Ant build.xml process from command line?



Normally I use Ant by clicking on a pre-defined build.xml process inside 
e.g. Eclipse.

However sometimes I would appreciate to have the chance to call Ant and an 
Ant build.xml script
from command line and pass e.g. a file to it. Something like:

java org.apache.ant.executescript D:\myproj\tbuild.xml 
D:\myproj\test222\somefile.java

Can I do this somehow?

If yes: how exactly would the command lokk like and how would I refer 
to the passed file (=parameter) from inside build.xml?

Ben







---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org




Re: How to pass a file to an Ant build.xml process from command line?

Posted by Morgan Kinne <ki...@us.ibm.com>.
Oops. Never mind.. I missed the eclipse part of your question.
Morgan



From:
Morgan Kinne/Raleigh/IBM
To:
"Ant Users List" <us...@ant.apache.org>
Date:
10/31/2008 03:43 PM
Subject:
Re: How to pass a file to an Ant build.xml process from command line?


First on the command line try:
ant -help

This will show you the command line options. You will notice:
ant -buildfile  myfavoritebuildfile.xml

is the option you are looking for.
Morgan




From:
"Ben Stover" <bx...@yahoo.co.uk>
To:
"Ant Users List" <us...@ant.apache.org>
Date:
10/31/2008 02:55 PM
Subject:
How to pass a file to an Ant build.xml process from command line?



Normally I use Ant by clicking on a pre-defined build.xml process inside 
e.g. Eclipse.

However sometimes I would appreciate to have the chance to call Ant and an 
Ant build.xml script
from command line and pass e.g. a file to it. Something like:

java org.apache.ant.executescript D:\myproj\tbuild.xml 
D:\myproj\test222\somefile.java

Can I do this somehow?

If yes: how exactly would the command lokk like and how would I refer 
to the passed file (=parameter) from inside build.xml?

Ben







---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org





Re: How to pass a file to an Ant build.xml process from command line?

Posted by Sann Maung <ya...@yahoo.com>.
You can use your tbuild.xml with -f 
$ ant -f tbuild.xml

For parameter you can write inside your build file
eg.
...="${yourFile}" ...

$ ant -f tbuild.xml -DyourFile=someFile.java


rgds,




--- On Sat, 11/1/08, Ben Stover <bx...@yahoo.co.uk> wrote:

> From: Ben Stover <bx...@yahoo.co.uk>
> Subject: How to pass a file to an Ant build.xml process from command line?
> To: "Ant Users List" <us...@ant.apache.org>
> Date: Saturday, November 1, 2008, 2:52 AM
> Normally I use Ant by clicking on a pre-defined build.xml
> process inside e.g. Eclipse.
> 
> However sometimes I would appreciate to have the chance to
> call Ant and an Ant build.xml script
> from command line and pass e.g. a file to it. Something
> like:
> 
> java org.apache.ant.executescript
> D:\myproj\tbuild.xml
> D:\myproj\test222\somefile.java
> 
> Can I do this somehow?
> 
> If yes: how exactly would the command lokk like and how
> would I refer 
> to the passed file (=parameter) from inside build.xml?
> 
> Ben
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


      

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org