Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在用 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:
xmlproperty
project.properties
AntBuilder
println ant.project.properties.'root.properties.foo'