Calling ant target in known xml file from within an Ant Task
问题 I'm writing an Ant Task: public class MyTask extends Task { public void execute() { .... } } Now I'm wondering whether it is possible for me to call a target that exists in another known xml file from within the above execute() method? Something like: public void execute() { AntCaller.call("anotherBuildFile.xml", "someTarget"); } 回答1: You are on the right track. If you wanted to all another task from XML, you would use <ant> (since it is another file.) You can call a task from Java only if