Ant build script executing <sql> task using java code
- by Jay
Any idea, why none of the debugging comments are printed once after executing the ANT build script's SQL task via java code?
The java class to execute the sql in build scirpt is
public class AntRunnerTest {
private Project project;
public void executeTask(String taskName) {
try {
project = new Project();
project.init();
project.setBasedir(new String("."));
ProjectHelper helper = ProjectHelper.getProjectHelper();
project.addReference("ant.projectHelper", helper);
helper.parse(project, new File("build-copy.xml"));
System.out.println("Before");
project.executeTarget(taskName);
System.out.println("After");
} catch(Exception ex) {
System.out.println(ex.getMessage());
}
}
public static void main(String args[]) {
try {
AntRunnerTest newInst = new AntRunnerTest();
newInst.executeTask("sql");
} catch(Exception e) {
System.out.println(""+e);
}
}
}
I dont see the debug String "After" getting printed in the console. I noticed this issue only when i try to execute a sql task using java code.
The ant script has the following simple transaction tag in it.
<transaction> <![CDATA[ select now() ]]> </transaction>
Any thoughts?
Thanks in advance.