Gradle中如何调用Ant任务呢?
我们都知道Ant任务是我们日常开发中常用的操作,
那么Gradle如何对Ant任务进行操作呢?
使用AntBuilder运行ant.loadfile
那么Gradle如何对Ant任务进行操作呢?
Gradle工具自带一个AntBuilder对Ant任务进行操作例:
使用AntBuilder运行ant.loadfile
---将以下文件保存至 build.gradle中:
task loadfile << {
def files = file('../antLoadfileResources').listFiles().sort()
files.each { File file ->
if (file.isFile()) {
ant.loadfile(srcFile: file, property: file.name)
println " *** $file.name ***"
println "${ant.properties[file.name]}"
}
}
}
c:\user\tmp > gradle -q loadfile
*** agile.manifesto.txt ***
Individuals and interactions over processes and tools
Working software over comprehensive documentation
Customer collaboration over contract negotiation
Responding to change over following a plan
*** gradle.manifesto.txt ***
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。


