문제

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