从java调用ant,ant终止后返回java

2023-12-02

到目前为止,我已经从java调用了ant脚本。现在的问题是,ant构建终止后是否可以恢复java执行?

我该怎么做?


org.apache.tools.ant.Main's main() and startAnt()方法调用exit()方法依次调用System.exit(code).

解决方案(假设您调用这些方法之一)是子类化org.apache.tools.ant.Main并覆盖exit() method

/**
 * 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);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

从java调用ant,ant终止后返回java 的相关文章

随机推荐