Hi Peter,
I am 100% certain that gradle is compiling the buildSrc project with 1.7.
See below for the output as well as the buildSrc build.gradle file
I was afraid that what you explain would be the case.
Thanks for your reply.

Erick.

build output:

edovale:deployments erickdovale$ gradle generatePlatformVersion
-PverLocations=tests-resources
:buildSrc:clean
:buildSrc:compileJava UP-TO-DATE
:buildSrc:compileGroovy
:buildSrc:processResources UP-TO-DATE
:buildSrc:classes
:buildSrc:jar
:buildSrc:assemble
:buildSrc:compileTestJava UP-TO-DATE
:buildSrc:compileTestGroovy
>>> a serious error occurred: The Spock compiler plugin could not run
because Spock 0.5.0-groovy-1.8 is not compatible with Groovy 1.7.10. For
more information, see http://versioninfo.spockframework.org
Spock location:
file:/Users/erickdovale/.gradle/caches/artifacts/filestore/8d7/8d73c5ad61d8f73d93c2c1cb0db67d971e50d1b4
Groovy location:
file:/usr/share/gradle-1.0-milestone-4/lib/groovy-all-1.7.10.jar
>>> stacktrace:
org.spockframework.util.IncompatibleVersionsError: The Spock compiler plugin
could not run because Spock 0.5.0-groovy-1.8 is not compatible with Groovy
1.7.10. For more information, see http://versioninfo.spockframework.org
Spock location:
file:/Users/erickdovale/.gradle/caches/artifacts/filestore/8d7/8d73c5ad61d8f73d93c2c1cb0db67d971e50d1b4
Groovy location:
file:/usr/share/gradle-1.0-milestone-4/lib/groovy-all-1.7.10.jar
at
org.spockframework.util.VersionChecker.checkSpockAndGroovyVersionsAreCompatible(VersionChecker.java:22)
at org.spockframework.compiler.SpockTransform.<init>(SpockTransform.java:42)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at
org.codehaus.groovy.transform.ASTTransformationVisitor.addPhaseOperationsForGlobalTransforms(ASTTransformationVisitor.java:299)
at
org.codehaus.groovy.transform.ASTTransformationVisitor.doAddGlobalTransforms(ASTTransformationVisitor.java:266)
at
org.codehaus.groovy.transform.ASTTransformationVisitor.addGlobalTransforms(ASTTransformationVisitor.java:187)
at
org.codehaus.groovy.transform.ASTTransformationVisitor.addPhaseOperations(ASTTransformationVisitor.java:150)
at
org.codehaus.groovy.control.CompilationUnit.<init>(CompilationUnit.java:181)
at
org.codehaus.groovy.control.CompilationUnit.<init>(CompilationUnit.java:112)
at
org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit.<init>(JavaAwareCompilationUnit.java:54)
at
org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit.<init>(JavaAwareCompilationUnit.java:50)
at
org.codehaus.groovy.tools.FileSystemCompiler.<init>(FileSystemCompiler.java:52)
at
org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:179)
at
org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:148)
at
org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:162)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileTestGroovy'.
Cause: Forked groovyc returned error code: 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output.

BUILD FAILED

Total time: 25.822 secs


build.gradle:

edovale:deployments erickdovale$ cat buildSrc/build.gradle
apply plugin: 'eclipse'
apply plugin: 'groovy'

// Defining maven repository
org.apache.ivy.util.url.CredentialsStore.INSTANCE.addCredentials(repoRealm,
repoUrl, repoUsername, repoPassword)
repositories {
mavenCentral()
    mavenRepo urls: "file://" + System.getProperty('user.home') +
"/.m2/repository/"
    mavenRepo urls: repoUrl, name: 'central'
}

dependencies {
 groovy group: 'org.codehaus.groovy', name: 'groovy-all', version: '1.8.1'
 testCompile group: 'org.spockframework', name:'spock-core', version:
'0.5-groovy-1.8'
testCompile group: 'com.h2database', name: 'h2', version: '1.3.158'
}


On Wed, Aug 10, 2011 at 4:07 PM, Peter Niederwieser <[email protected]>wrote:

> Are you sure it is trying to compile buildSrc using Groovy 1.7.10? Anyway,
> Groovy 1.8 can't be used for build-related code at this time. This is
> because Gradle will always execute the code with 1.7, and code compiled
> against 1.8 cannot be executed with 1.7.
>
> We've started work on upgrading Gradle to Groovy 1.8, but we have to wait
> for some Groovy 1.8 bugs to be fixed. Depending on when this happens, we
> will upgrade before or after Gradle 1.0.
>
> --
> Peter Niederwieser
> Principal Engineer, Gradleware
> http://gradleware.com
> Creator, Spock Framework
> http://spockframework.org
> Twitter: @pniederw
>
>
> edovale wrote:
> >
> > Folks,
> > I have a gradle file that uses some scripts I have created ina buildSrc
> > directory. These scripts are using groovy 1.8 features and therefore need
> > to
> > be compiled against groovy 1.8.
> > When I run gradle on the buildSrc directory directly it works like a
> > charm,
> > however, when I run gradle on the top project it is trying to compile the
> > buildSrc project using 1.7.10 and this, as expected, fails.
> > How can I work around this?
> >
> > Thanks.
> >
> > Erick.
> >
>
>
> --
> View this message in context:
> http://gradle.1045684.n5.nabble.com/buildSrc-and-groovy-1-8-tp4687017p4687103.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to