> 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
|