Posted By:
Aashay_Saralkar
Posted On:
Thursday, November 15, 2007 06:42 AM
Hi All, I am a newbie at executing ANT through Java and ran into a roadblock while tryin to do the following : i have a build.xml containing a target with mkdir task I want to execute this target repeatedly for different values to the property 'property1'.The source code looks like project = new Project(); File buildFile = new File(repeaterConfig.getBuildXMLPath()); project.setUserProperty("ant.file", buildFile.getAbsolutePath()); project.init(); ProjectHelper helper = ProjectHelper.getProjectHelper(); project.addReference("ant.projectHelper", helper); helper.parse(project, build
More>>
Hi All,
I am a newbie at executing ANT through Java and ran into a roadblock while tryin to do the following :
i have a build.xml containing a target with mkdir task
I want to execute this target repeatedly for different values to the property 'property1'.The source code looks like
project = new Project();
File buildFile = new File(repeaterConfig.getBuildXMLPath());
project.setUserProperty("ant.file", buildFile.getAbsolutePath());
project.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
project.addReference("ant.projectHelper", helper);
helper.parse(project, buildFile);
for(int i=0;i
<5;i++){
project.setProperty("property1","test"+i);
project.executeTarget("createDirectory");
}
The target executes successfully for the first time creating folder 'test0' but fails in rest of the iterations.
Using the verbose flag i found out that the value for property 'property1' was getting replaced properly in every iteration, but for some reason the target keeps on using the initially set value for 'property1' which is 'test0'.
Is there some basic mistake i am making here ?
<<Less