Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Grails 如何使用AntBuilder在_Events.groovy脚本中运行ant?_Grails_Ant_Groovy_Build - Fatal编程技术网

Grails 如何使用AntBuilder在_Events.groovy脚本中运行ant?

Grails 如何使用AntBuilder在_Events.groovy脚本中运行ant?,grails,ant,groovy,build,Grails,Ant,Groovy,Build,我正在尝试自动化一个构建过程,该过程涉及在几个目录上循环并在所有目录上运行“ant all”。它们都有一个简单的build.xml 我可以通过一个shell脚本来实现这一点,但是我正在使用Groovy中的其他东西,例如,使用UI性能Grails插件,所以我想继续使用Groovy web上的所有文档/论坛/其他问题,请谈谈运行ant.exec和其他AntBuilder方法,但我没有运行简单的ant All。尝试以下示例 def ant = new AntBuilder() ant.fileset

我正在尝试自动化一个构建过程,该过程涉及在几个目录上循环并在所有目录上运行“ant all”。它们都有一个简单的build.xml

我可以通过一个shell脚本来实现这一点,但是我正在使用Groovy中的其他东西,例如,使用UI性能Grails插件,所以我想继续使用Groovy


web上的所有文档/论坛/其他问题,请谈谈运行ant.exec和其他AntBuilder方法,但我没有运行简单的ant All。

尝试以下示例

def ant = new AntBuilder()

ant.fileset(id:"builds", dir:".", includes:"**/build.xml")

ant.project.references.builds.each {
    ant.project.log "Building ${it}"
    ant.ant(antfile:it, target:"all")
}

对于我来说,它是一个独立的groovy脚本(我还没有尝试从grails调用它)

我找到了一种更简单的方法,使用subant任务。大概是这样的:

ant.subant(target:"all") {
    fileset(dir:"${pathToBuildDir}" includes:"build.xml") 
}

谢谢@markoconnor,不过我找到了一个更简单的方法,使用subant,如下所示。