[GRADLE-367] Groovy 1.6 support Created: 24/Jan/09  Updated: 04/Jan/13  Resolved: 13/Apr/09

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 0.6

Type: New Feature
Reporter: Peter Niederwieser Assignee: Hans Dockter
Resolution: Not A Bug Votes: 0


 Description   

Last time I checked (back in December), the following problems occurred when building a Groovy application against Groovy 1.6 trunk:

1. In forked mode, compilation failed due to org.groovy.ant.Groovyc not being backwards-compatible
2. In non-forked mode, AST transformations weren't working

If you need any help to make AST transformations work, just let me know.



 Comments   
Comment by Peter Niederwieser [ 24/Jan/09 ]

It's org.codehaus.groovy.ant.Groovyc

Comment by Hans Dockter [ 01/Feb/09 ]

Peter could remember the following detail: Some class calls in the forked VM its own main method. But this method does not exists in 1.6 nicht mehr (or has been moved)

Comment by Peter Niederwieser [ 01/Feb/09 ]

As far as I remember, org.codehaus.groovy.ant.Groovyc@1.5.6 tries to call org.codehaus.groovy.ant.Groovyc@1.6.main in a forked VM. But as of 1.6, this main method has been moved into class FileSystemCompiler.

Comment by Adam Murdoch [ 06/Apr/09 ]

Could you test this again using the released Groovy 1.6.0, and the Gradle trunk? Our integration tests are now all passing fine with 1.6.0, including AST transformations

Comment by Peter Niederwieser [ 11/Apr/09 ]

Using Gradle trunk rev. 1328, I still get the same error as before when compiling Groovy code. Do I need to tell Gradle to also use Groovy 1.6 internally?

13:30:18.928 [Thread-2] ERROR Console out - Exception in thread "main" java.lang.NoSuchMethodError: main
13:30:19.001 [main] ERROR org.gradle.Main - 
Build failed with an exception.
Run with -f option to get the full (very verbose) stacktrace.

Build file '/swd/prj/spock/trunk/spock-specks/build.gradle'

Execution failed for task ':spock-specks:testCompile'.
Cause: Forked groovyc returned error code: 1

Exception is:
org.gradle.api.GradleScriptException: Build file '/swd/prj/spock/trunk/spock-specks/build.gradle'
Execution failed for task ':spock-specks:testCompile'.
	at org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:184)
	at org.gradle.execution.DefaultTaskExecuter.executeTask(DefaultTaskExecuter.java:153)
	at org.gradle.execution.DefaultTaskExecuter.doExecute(DefaultTaskExecuter.java:144)
	at org.gradle.execution.DefaultTaskExecuter.execute(DefaultTaskExecuter.java:67)
	at org.gradle.execution.TaskNameResolvingBuildExecuter.execute(TaskNameResolvingBuildExecuter.java:88)
	at org.gradle.Gradle.runInternal(Gradle.java:121)
	at org.gradle.Gradle.run(Gradle.java:93)
	at org.gradle.Main.execute(Main.java:229)
	at org.gradle.Main.main(Main.java:79)
	at org.gradle.BootstrapMain.main(BootstrapMain.java:53)
Caused by: org.apache.tools.ant.BuildException: Forked groovyc returned error code: 1
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at Script1.run(Script1.groovy:5)
	at org.gradle.util.GradleUtil.executeIsolatedAntScript(GradleUtil.groovy:94)
	at org.gradle.api.tasks.compile.AntGroovyc.execute(AntGroovyc.groovy:56)
	at org.gradle.api.tasks.compile.GroovyCompile.compile(GroovyCompile.java:81)
	at org.gradle.api.tasks.compile.GroovyCompile$1.execute(GroovyCompile.java:54)
	at org.gradle.api.internal.AbstractTask.doExecute(AbstractTask.java:220)
	at org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:174)
	... 9 common frames omitted
13:30:19.002 [main] ERROR org.gradle.Main - 
BUILD FAILED
Comment by Hans Dockter [ 13/Apr/09 ]

I'm really sorry that I had not looked earlier at this problem. It is easy to fix. We have two bugs, one in the Spock build script the other in Gradle.

Changing the build.gradle of spock-specs from:

java "org.codehaus.groovy:groovy-all:1.6.0"

to

groovy "org.codehaus.groovy:groovy-all:1.6.0"

Gradle is not smart enough yet to get Groovyc from the compile classpath. You have to add the Groovy jar to the groovy configuration (compile extends groovy). See also the user's guide on the Groovy plugin. The bug in Gradle is, that Gradle has not complained, but instead was using the internal Groovy.

Comment by Peter Niederwieser [ 13/Apr/09 ]

Thanks Hans, this solves my problem.

Generated at Wed Jun 30 11:28:21 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.