Вопрос

I am writing a task with gant and I am getting struggled with the task xmlProperty. I have this example xml file:

<root>
    <properties>
        <foo>bar</foo>
    </properties>
</root>

and when I do:

ant.xmlproperty(file:"myFile.xml")
println "${root.properties.foo}"

nothing is printed. Any idea what I am doing wrong?

Это было полезно?

Решение

xmlproperty loads the file in to Ant properties, not Groovy variables, so you need to access them via project.properties on the AntBuilder instance:

println ant.project.properties.'root.properties.foo'
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top