Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
Ant version 1.6.4
Windows XP SP2
Groovy 1.0 JSR-3
-
Patch
Description
Groovy does not appear to have support for running ant tasks that were loaded via antlib. I request that we add this support, because not having it hampers development of ant scripts.
Ant added the antlib feature in ant 1.6.0, here is a brief rundown of how antlib is used, and why groovy wasn't working for me:
When you use antlib tasks you first specify their namespace at the top of the buildfile like so:
<project name="foobar" ... xmlns:artifact="antlib:org.apache.maven.artifact.ant">
and then later on in the buildfile you can execute them like this
<artifact:dependencies pathId="foobar.classpath">
<dependency groupId="foo" artifactId="bar" version="1.1" />
...
</artifact:dependencies>
You can execute ant tasks from the AntBuilder by making groovy calls like this:
ant.<taskname>(attributes)
For example:
ant.property(name:"myprop",value:"some value")
However this does not work for tasks loaded via antlib.
The calls fail in either the abbreviated or the complete form
ant.artifact:dependencies(...) {
...
}
ant.antlib:org.apache.maven.artifact:dependencies(...) {
...
}
I'm guessing that this doesn't work because the tasks' name contains periods and colons.
You can read more about antlib here http://ant.apache.org/manual/CoreTypes/antlib.html and here http://ant.apache.org/manual/CoreTypes/namespace.html