SAPHybris使用recipe进行安装时,是如何执行ant命令的?-创新互联
打开Hybris安装文件夹下的recipes,随便打开一个recipe的build.gradle文件,发现使用了installer-platform-plugin和installer-addon-plugin这两个plugin. Groovy setup任务的逻辑,也就是使用这两个plugin里的实现,根据config实例化platform对象,然后调用其setup方法和executeAntTarget方法。
苍溪ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:028-86922220(备注:SSL证书合作)期待与您的合作!
这两个方法的实现源代码在哪里?这就是本文所要描述的内容。
去docs文件夹里可以找到插件的实现源代码:

到源代码里根据executeAntTarget进行搜索:

在AbstractPlatform.groovy里找到了executeAntTarget的实现逻辑,发现其delegate到了成员属性antExecutor里:

这个antExecutor的类型是HybrisAntExecutor:

找到HybrisAntExcutor,发现其只不过是调用类HybrisPluginUtils的静态方法:

静态方法之一:runProcess
实现核心:
private static void runExternalProcess(String workDir, String[] command, Closure closure) {
def builder = new DefaultExecHandleBuilder()
builder.setWorkingDir((new File(workDir)).absolutePath)
builder.setCommandLine(command)
if (closure) closure.call(builder)
def handle = builder.build()
handle.start()
def result = handle.waitForFinish()
if (result.getExitValue() != 0) {
throw new IllegalStateException("external process returned non-zero exit code, command: ${command}")
}
} 分享标题:SAPHybris使用recipe进行安装时,是如何执行ant命令的?-创新互联
本文网址:http://www.scyingshan.cn/article/ccpoig.html


咨询
建站咨询
