ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: passing parameters to ant
Date Wed, 13 Aug 2003 08:16:43 GMT
> 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

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