Run ant from Java

后端 未结 1 795
轮回少年
轮回少年 2020-11-27 04:21

Is there a tutorial on how to run Ant from Java? I got some code from here: Setting JAVA_HOME when running Ant from Java

But haven\'t been able to make it work. I\'v

相关标签:
1条回答
  • 2020-11-27 04:45

    Is there a tutorial on how to run Ant from Java?

    Part of my answer to this question might help:

    See this article and this article:

       File buildFile = new File("build.xml");
       Project p = new Project();
       p.setUserProperty("ant.file", buildFile.getAbsolutePath());
       p.init();
       ProjectHelper helper = ProjectHelper.getProjectHelper();
       p.addReference("ant.projectHelper", helper);
       helper.parse(p, buildFile);
       p.executeTarget(p.getDefaultTarget());
    
    0 讨论(0)
提交回复
热议问题