我正在用gant编写任务,而在任务xmlProperty方面遇到了麻烦。我有这个示例xml文件:
<root>
<properties>
<foo>bar</foo>
</properties>
</root>
当我这样做时:
ant.xmlproperty(file:"myFile.xml")
println "${root.properties.foo}"
什么都不会打印。知道我在做什么错吗?
最佳答案
xmlproperty
将文件加载到Ant属性中,而不是Groovy变量中,因此您需要通过project.properties
实例上的AntBuilder
访问它们:
println ant.project.properties.'root.properties.foo'
关于grails - 在GANT中使用xmlProperty任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23339646/