Fails to build on Ubuntu 15.10 due to system installed groovy2 2.4.3 #97

Open
iam-TJ opened this Issue Nov 21, 2015 · 2 comments

Comments

Projects
None yet
1 participant

iam-TJ commented Nov 21, 2015

On Ubuntu 15.10 the system-installed groovy2 2.4.3 over-rides the project dependency on 2.4, but I'm not sure how to tell gradle to ignore the system-installed package, or even if that is possible.

$ gradle build

FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/all/SourceCode/jd-gui/build.gradle'

  • What went wrong:
    Could not compile build file '/home/all/SourceCode/jd-gui/build.gradle'.

    startup failed:
    Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/home/tj/.gradle/caches/modules-2/files-2.1/org.spockframework/spock-core/1.0-groovy-2.3/762fbf6c5f24baabf9addcf9cf3647151791f7eb/spock-core-1.0-groovy-2.3.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 1.0.0-groovy-2.3 is not compatible with Groovy 2.4.3. For more information, see http://versioninfo.spockframework.org
    Spock artifact: file:/home/tj/.gradle/caches/modules-2/files-2.1/org.spockframework/spock-core/1.0-groovy-2.3/762fbf6c5f24baabf9addcf9cf3647151791f7eb/spock-core-1.0-groovy-2.3.jar
    Groovy artifact: file:/usr/share/java/groovy-all-2.x.jar

$ apt-cache policy groovy2
groovy2:
Installed: 2.4.3+dfsg-2ubuntu1
Candidate: 2.4.3+dfsg-2ubuntu1
Version table:
*** 2.4.3+dfsg-2ubuntu1 0
500 http://archive.ubuntu.com/ubuntu/ wily/universe amd64 Packages
100 /var/lib/dpkg/status

$ apt-cache rdepends groovy2
groovy2
Reverse Depends:
libxbean-java
libgradle-core-java
libelasticsearch1.6-java
gant
freeplane

$ apt-cache depends gradle
gradle
Depends: default-jre-headless
Depends: libgradle-core-java
....

$ apt-cache depends libgradle-core-java
libgradle-core-java
Depends: ant
Depends: groovy2
...

iam-TJ commented Nov 21, 2015

Update. The various build.gradle files declare:

compile 'org.codehaus.groovy:groovy:2.4.0'

but the files fetched into the gradle cache are:

$ ls -l ~/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.3.10/*
/home/tj/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.3.10/871fd599951c0acd361d3c4752e874d809b44f89:
total 28
-rw-r--r-- 1 tj root 18404 Nov 21 04:31 groovy-all-2.3.10.pom

/home/tj/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.3.10/e6fc2dc8fe2512efa0e78a2c0ae52ea1d724106d:
total 7132
-rw-r--r-- 1 tj root 7291855 Nov 21 04:31 groovy-all-2.3.10.jar

iam-TJ commented Nov 21, 2015

The fix appears to be to update the classpath in build.gradle

diff --git a/build.gradle b/build.gradle
index ef05a24..056612e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {

     dependencies {
         classpath 'com.netflix.nebula:gradle-ospackage-plugin:2.2.6'
-        classpath 'org.spockframework:spock-core:1.0-groovy-2.3'
+        classpath 'org.spockframework:spock-core:1.0-groovy-2.4'
     }
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment