调用从Java的蚂蚁,然后返回到Java蚂蚁终止后 [英] Invoke ant from java, then return to java after ant termination

查看:113
本文介绍了调用从Java的蚂蚁,然后返回到Java蚂蚁终止后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

so far i have invoked ant script from java. Now the question is, is it possible to resume java execution after the termination of the ant build?

我该怎么办呢?

推荐答案

org.apache.tools.ant.Main 的main() startAnt()方法调用退出()方法依次调用 System.exit(code)

org.apache.tools.ant.Main's main() and startAnt() methods call the exit() method which in turn calls System.exit(code).

解决方案(假设你调用这些方法之一)是子类 org.apache.tools.ant.Main 并重写退出()

The solution (assuming you call one of those methods) is to sub-class org.apache.tools.ant.Main and override the 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);
}

这篇关于调用从Java的蚂蚁,然后返回到Java蚂蚁终止后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆