Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-1070

Add antlib support to Groovy ant support

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-RC-1
    • Ant integration
    • 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)

      { subelements }

      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

      Attachments

        1. antbuilder-with-antlib.patch
          1 kB
          Andreas Sahlbach
        2. antbuilder-with-antlib-2.patch
          0.5 kB
          Andreas Sahlbach
        3. test-for-antbuilder-with-antlib.patch
          2 kB
          Andreas Sahlbach

        Activity

          People

            galleon Ryan Harris
            jgibson John Gibson
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: