Ant build script executing <sql> task using java code

Posted by Jay on Stack Overflow See other posts from Stack Overflow or by Jay
Published on 2009-11-02T19:21:16Z Indexed on 2010/06/09 1:12 UTC
Read the original article Hit count: 225

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about java

Related posts about ant