I have following error when building my spplication:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/C:/Users/edvorkin/.gradle/caches/artifacts-14/filestore/org.spockframework/spock-core/0.7-groovy-2.0/jar/4de0b428de0c14b6eb6375d8174f71848cbfc1d7/spock-core-0.7-groovy-2.0.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation
because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 0.7.0-groovy-2.0 is not compatible with Groovy 1.8.6. For more information, see http://versioninfo.spockframework.org
Spock location: file:/C:/Users/edvorkin/.gradle/caches/artifacts-14/filestore/org.spockframework/spock-core/0.7-groovy-2.0/jar/4de0b428de0c14b6eb6375d8174f71848cbfc1d7/spock-core-0.7-groovy-2.0.jar
Groovy location: file:/C:/Applications/gradle-1.2/lib/groovy-all-1.8.6.jar
1 error
FAILED
In my build script I reference groovy-all.2.0.4 and groovy is in my path. how can I force gradle to use groovy 2.0 instead of groovy 1.8?
Can you please show your Groovy dependency declaration? How are you getting ‘file:/C:/Applications/gradle-1.2/lib/groovy-all-1.8.6.jar’ on the class path? Are you using ‘groovyLocal()’ or ‘gradleApi()’ dependencies?
You add ‘groovy-all’, but force ‘groovy’ * Somewhere, you must be adding Groovy to the ‘groovy’ configuration (otherwise compilation would fail), and apparently you add ‘groovyLocal()’ (which in your case you shouldn’t). Is this a multi-project build? * Why do you add Ivy to the ‘groovy’ configuration? Is this for ‘@Grab’? If not, you should get rid of this.
PS: In general, it’s safer to use ‘groovy-all’ than ‘groovy’, because the former packages shaded versions of its dependencies (e.g. ASM).
There could always be a ‘~/.gradle/init.gradle’ interfering, but I doubt that’s the case. Have you tried to remove the Cobertura plugin? Besides, you shouldn’t need to put Ivy on the ‘groovy’ configuration in order to get the Cobertura plugin to work.