我正在尝试自动化构建过程,该过程涉及循环几个目录并在所有目录上运行“ant all”。它们都有一个简单的 build.xml。
我可以通过 shell 脚本来完成此操作,但我正在使用 Groovy 中的其他内容,例如使用 UI Performance Grails 插件,所以我想坚持使用 Groovy。
网络上的所有文档/论坛/其他问题,都讨论了运行 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调用它)
关于grails - 如何使用 AntBuilder 在 _Events.groovy 脚本中运行 ant?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16504682/