Gant

Nested elements of depth > 1 require the ant. prefix.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Core
  • Labels:
    None
  • Number of attachments :
    0

Description

I am executing some Ant targets via Gant in a Grails script.
I've noticed that gant fails for nested elements that are 2 or more deep.

e.g. the following example from this page: http://groovy.codehaus.org/Using+Ant+from+Groovy

value = ant.path {
        fileset(dir: "mybuild") {
          include(name: "**/*.js")
        }
      }

fails with this error:

Error executing script TestApp: path doesn't support the nested "include" element.
gant.TargetExecutionException: path doesn't support the nested "include" element.
	at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:331)
	at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
	at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
	at gant.Gant.withBuildListeners(Gant.groovy:344)
	at gant.Gant.this$2$withBuildListeners(Gant.groovy)
	at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
	at gant.Gant.dispatch(Gant.groovy:334)
	at gant.Gant.this$2$dispatch(Gant.groovy)
	at gant.Gant.invokeMethod(Gant.groovy)
	at gant.Gant.processTargets(Gant.groovy:495)
	at gant.Gant.processTargets(Gant.groovy:480)
Caused by: path doesn't support the nested "include" element.
	at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:359)
	at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:198)
	at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:160)
	at BuildConfig$_run_closure1_closure2.doCall(BuildConfig.groovy:33)
	at _Events$_run_closure4.doCall(_Events.groovy:72)
	at _GrailsEvents_groovy$_run_closure5.doCall(_GrailsEvents_groovy:58)
	at _GrailsEvents_groovy$_run_closure5.call(_GrailsEvents_groovy)
	at _GrailsTest_groovy$_run_closure1.doCall(_GrailsTest_groovy:214)
	at TestApp$_run_closure1.doCall(TestApp.groovy:102)
	at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
	... 10 more
Caused by: The <path> type doesn't support the nested "include" element.
	at org.apache.tools.ant.IntrospectionHelper.throwNotSupported(IntrospectionHelper.java:447)
	at org.apache.tools.ant.IntrospectionHelper.getNestedCreator(IntrospectionHelper.java:506)
	at org.apache.tools.ant.IntrospectionHelper.getElementCreator(IntrospectionHelper.java:567)
	at org.apache.tools.ant.UnknownElement.handleChild(UnknownElement.java:546)
	at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:346)
	... 19 more
Error executing script TestApp: path doesn't support the nested "include" element.
Application context shutting down...

By changing that code to:

value = ant.path {
        ant.fileset(dir: "mybuild") {
          include(name: "**/*.js")
        }
      }

all works fine. ie. changing fileset to ant.fileset is a work around for this.

Activity

Hide
Nick Pellow added a comment -

This is occurring under grails 1.2.1 . I am not certain which version of GANT is being used there - I would be using the default GANT that is shipped with grails 1.2.1 however.

Cheers,
Nick

Show
Nick Pellow added a comment - This is occurring under grails 1.2.1 . I am not certain which version of GANT is being used there - I would be using the default GANT that is shipped with grails 1.2.1 however. Cheers, Nick
Hide
Russel Winder added a comment -

I think the problem here then is that Grails is using Gant 1.6.0 which probably has these problems. Current Gant is 1.9.1. I guess the experiment to try is replacing the Gant version in Grails with something more up to date.

Show
Russel Winder added a comment - I think the problem here then is that Grails is using Gant 1.6.0 which probably has these problems. Current Gant is 1.9.1. I guess the experiment to try is replacing the Gant version in Grails with something more up to date.
Hide
Nick Pellow added a comment -

Thanks, Russel.

I will try and give that a go, then raise an issue against Grails to upgrade to Gant 1.9.1 if that fixes the problem.
Is upgrading simply a matter of replacing the existing gant jar in GRAILS_HOME/lib ?

Cheers,
Nick

Show
Nick Pellow added a comment - Thanks, Russel. I will try and give that a go, then raise an issue against Grails to upgrade to Gant 1.9.1 if that fixes the problem. Is upgrading simply a matter of replacing the existing gant jar in GRAILS_HOME/lib ? Cheers, Nick
Hide
Russel Winder added a comment -

Nick,

Yes, I think replacing the jar is all that is needed. Make sure though that you use the Gant jar from the correct Groovy series. Grails currently uses Groovy 1.6.7 so you need the Gant compiled against Groovy 1.6.7 – gant_groovy1.6-1.9.1.jar is the one to use.

Show
Russel Winder added a comment - Nick, Yes, I think replacing the jar is all that is needed. Make sure though that you use the Gant jar from the correct Groovy series. Grails currently uses Groovy 1.6.7 so you need the Gant compiled against Groovy 1.6.7 – gant_groovy1.6-1.9.1.jar is the one to use.
Hide
Nick Pellow added a comment -

Hi Russel,

Grails 1.2.1 definitely ships with gant: gant_groovy1.6-1.6.0.jar .
I tried upgrading this version to the 1.6.7 version of 1.9.1 you mentioned above, by dropping it into the GRAILS_HOME/lib dir and updating GRAILS_HOME/conf/groovy-starter.conf with the correct new path.

Unfortunately Grails could not start after this, with the following error:

Error starting Grails: gant/TargetExecutionException
java.lang.NoClassDefFoundError: gant/TargetExecutionException
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
	at java.lang.Class.getMethod0(Class.java:2670)
	at java.lang.Class.getMethod(Class.java:1603)
	at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:206)
	at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:240)

I double checked that I had correctly updated the paths and that that class does exist in the gant 1.9.1 jar, to no avail.

Were you able to upgrade Grails 1.2.1 to Gant 1.9.1 ?

Cheers,
Nick

Show
Nick Pellow added a comment - Hi Russel, Grails 1.2.1 definitely ships with gant: gant_groovy1.6-1.6.0.jar . I tried upgrading this version to the 1.6.7 version of 1.9.1 you mentioned above, by dropping it into the GRAILS_HOME/lib dir and updating GRAILS_HOME/conf/groovy-starter.conf with the correct new path. Unfortunately Grails could not start after this, with the following error:
Error starting Grails: gant/TargetExecutionException
java.lang.NoClassDefFoundError: gant/TargetExecutionException
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
	at java.lang.Class.getMethod0(Class.java:2670)
	at java.lang.Class.getMethod(Class.java:1603)
	at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:206)
	at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:240)
I double checked that I had correctly updated the paths and that that class does exist in the gant 1.9.1 jar, to no avail. Were you able to upgrade Grails 1.2.1 to Gant 1.9.1 ? Cheers, Nick
Hide
Russel Winder added a comment -

I think this must be an environment issue:

|> jar tvf ~/.m2/repository/org/codehaus/gant/gant_groovy1.6/1.9.1/gant_groovy1.6-1.9.1.jar | grep Exception
  5773 Thu Dec 31 12:08:46 GMT 2009 gant/TargetExecutionException.class
  7903 Thu Dec 31 12:08:46 GMT 2009 gant/GantException.class
  5761 Thu Dec 31 12:08:46 GMT 2009 gant/MissingTargetException.class
  5932 Thu Dec 31 12:08:46 GMT 2009 gant/TargetMissingPropertyException.class

the class is in the jar file.

I think you need to raise a Grails issue – and perhaps cross link to this issue?

Show
Russel Winder added a comment - I think this must be an environment issue:
|> jar tvf ~/.m2/repository/org/codehaus/gant/gant_groovy1.6/1.9.1/gant_groovy1.6-1.9.1.jar | grep Exception
  5773 Thu Dec 31 12:08:46 GMT 2009 gant/TargetExecutionException.class
  7903 Thu Dec 31 12:08:46 GMT 2009 gant/GantException.class
  5761 Thu Dec 31 12:08:46 GMT 2009 gant/MissingTargetException.class
  5932 Thu Dec 31 12:08:46 GMT 2009 gant/TargetMissingPropertyException.class
the class is in the jar file. I think you need to raise a Grails issue – and perhaps cross link to this issue?
Hide
Jeff Brown added a comment -

FYI...

Grails has been upgraded to use Gant 1.9.1.

http://github.com/grails/grails-core/commit/7101536f44429a5c61071df98e6c215837301da4

That is on the Grails 1.3 branch.

Show
Jeff Brown added a comment - FYI... Grails has been upgraded to use Gant 1.9.1. http://github.com/grails/grails-core/commit/7101536f44429a5c61071df98e6c215837301da4 That is on the Grails 1.3 branch.
Hide
Nick Pellow added a comment -

That is excellent, Jeff.
I will try and find the time to test this today.

Show
Nick Pellow added a comment - That is excellent, Jeff. I will try and find the time to test this today.
Hide
Russel Winder added a comment -

Grails 1.3 is now using Gant 1.9.2. I believe the problems go away with this combination. It would be good if this assertion could be tested.

Show
Russel Winder added a comment - Grails 1.3 is now using Gant 1.9.2. I believe the problems go away with this combination. It would be good if this assertion could be tested.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: