到目前为止,我已经从 java 调用了 ant 脚本。现在的问题是,是否可以在ant构建终止后恢复java执行?
我该怎么做?
最佳答案
org.apache.tools.ant.Main
的 main()
和 startAnt()
方法调用 exit( )
方法依次调用 System.exit(code)
。
解决方案(假设您调用其中一种方法)是子类化 org.apache.tools.ant.Main
并覆盖 exit()
方法
/**
* This operation is expected to call {@link System#exit(int)}, which
* is what the base version does.
* However, it is possible to do something else.
* @param exitCode code to exit with
*/
protected void exit(int exitCode) {
System.exit(exitCode);
}
关于java - 从java调用ant,ant终止后返回java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8714262/