ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manju Sarala Viswam <>
Subject RE: passing parameters to ant
Date Wed, 13 Aug 2003 08:27:47 GMT
Hi ,
I want to pass Parameters to a target in ant build file .Target has a task
like :

Here , testcaseid ,value , logvalue are all parameters to be accessed in
this task.Till now, I have been writing all these values to a text file from
my Javacode and loading the textfile as a property in the build file.But
when multiple instances of my java program is running, writing to a file is
not reliable.SO I need a alternate solution by which I can pass parameters .

Thanks & regards, 

Manju S Viswam

-----Original Message-----
From: [
<> ]
Sent: Wednesday, August 13, 2003 1:47 PM
Subject: RE: passing parameters to ant

> Hi,
>         I am using ant API and executing ant task from Java
> as shown below.
> I want to pass few parameters to ant build file.How do I do it ?

What kind of parameter?
- Properties (like: -Dkey=value)
- Targets    (like: ant build compile)
- Options    (like: ant -diagnostics -version)

> public class RunningAnt extends Ant
> {
>         public RunningAnt(String buildFile) throws BuildException

I recommend renaming that parameter to buildDir. You donĀ“t set the buildFILE

>         {
>                 project = new Project();
>                 project.init();
>                 taskType = "ant";
>                 taskName = "ant";
>                 setDir(new File(buildFile));
>                 setAntfile(buildFile+"\\build.xml");

Or better: use for extracting the directory from the buildfile
pass really the buildfile to RunningAnt.

>                 project.addBuildListener(new AntListener());
>         }
>         public static void main (String []args){
>                 RunningAnt Ra = new RunningAnt("D:\\rtf\\tests\\");
>                 Ra.execute();
>         }
> }
> Thanks
> Manju


The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this message
by anyone else is unauthorized. If you are not the intended recipient, any
disclosure, copying, or distribution of the message, or any action or
omission taken by you in reliance on it, is prohibited and may be unlawful.
Please immediately contact the sender if you have received this message in


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message