I was trying
Ant.echo("hello gant")
but I am getting this 开发者_StackOverflow中文版error message:
No such property: Ant for class: build
Any help would be highly appreciated.
In groovy you first need to create an instance of the AntBuilder class. The following code works:
def ant = new AntBuilder()
ant.echo("Hello world")
gant is also having "ant" injected itself
Actually in grails ant is avaiale by default.
ant.echo("hello gant")
You just need to use lower-case "a" in "ant" and run it. This should work fine.
The short answer to this question is just change Ant.echo to ant.echo or just omit "ant." and "echo" directly. It will call the ant.echo.
Another case will often cause this issue is when we define the property. Do not use property name like "ant.lib.path", "xx.xx.xx", it's not working in gant, gant will treat "lib" is the property of "ant" and "path" is property of "lib" , which is not correct, use "antLibPath" form instead.
精彩评论