ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manju Sarala Viswam <mvis...@vanenburg.com>
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 :
<mkdir
dir="${env.CORDYS_HOME}/Web/TestFramework/Log/${testcaseid}/${value}/${logva
lue}"/>

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: Jan.Materne@rzf.fin-nrw.de [ mailto:Jan.Materne@rzf.fin-nrw.de
<mailto:Jan.Materne@rzf.fin-nrw.de> ]
Sent: Wednesday, August 13, 2003 1:47 PM
To: user@ant.apache.org
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
here...


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

Or better: use java.io.File for extracting the directory from the buildfile
and
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



Jan




**********************************************************************
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
error.

**********************************************************************


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