Simple version problem with groovy-all

3,588 views
Skip to first unread message

David Karr

unread,
Mar 4, 2015, 6:54:02 PM3/4/15
to spockfr...@googlegroups.com
I've got a lot of firsts today.  First Gradle plugin, first Groovy class (ok, I've written some Groovy scripts already), and first Spock spec.  I'm stuck at a high level.

My code under test is still pretty skeletal right now, but the build was passing at least, until I added the spock infrastructure.  When I run the build, I see this:
Conflicting module versions. Module [groovy-all is loaded in version 2.3.9 and you are trying to load version 2.3.10

With some minor elisions, here's my Gradle script:
buildscript {
    repositories
{
        jcenter
()
        mavenCentral
()
   
}
}

apply plugin
: 'groovy'
apply plugin
: 'java-gradle-plugin'

repositories
{
    mavenCentral
()
    jcenter
()
    maven
{ url "http://oss.sonatype.org/content/repositories/releases/" }
}

dependencies
{
    compile
"org.codehaus.groovy:groovy-all:2.3.9"
    compile gradleApi
()
    testCompile
"org.spockframework:spock-core:1.0-groovy-2.3"
}

sourceCompatibility
= 1.7

version    
= '1.0.0-SNAPSHOT'


I would show my first almost empty spec, but I have a feeling that won't matter.  What might be wrong here?

Luke Daley

unread,
Mar 4, 2015, 6:57:09 PM3/4/15
to spockfr...@googlegroups.com
You’ve got duplicate copies of Groovy on the classpath, because Spock depends on `groovy`, while you are also dragging in `groovy-all`. 

Your dependencies block should be:

dependencies {
  compile localGroovy()
  compile gradleApi()
  testCompile “org.spockframework:spock-core:1.0-groovy-2.3”, {
    exclude group “org.codehaus.groovy"
  }
--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spockframewor...@googlegroups.com.
To post to this group, send email to spockfr...@googlegroups.com.
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

KARR, DAVID

unread,
Mar 4, 2015, 7:07:53 PM3/4/15
to spockfr...@googlegroups.com

Thanks for the quick reply.

 

Now I get the following:

Could not find method testCompile() for arguments [org.spockframework:spock-core:1.0-groovy-2.3, build_12i2645wk28nm3p2hhs5mtsd3$_run_closure2_closure6@5f9b80c2] on root project 'GradleYangPlugin'.

Luke Daley

unread,
Mar 4, 2015, 7:12:44 PM3/4/15
to spockfr...@googlegroups.com, KARR, DAVID
I missed a colon, it should be:

KARR, DAVID

unread,
Mar 4, 2015, 7:24:36 PM3/4/15
to spockfr...@googlegroups.com

(By the way, your code sample is coming out as rich text, which translates those double quotes to “smart quotes”, which are not valid in the code. I have to replace those if I insert from your sample.)

 

Ok, that works, which led me to my next problem, which is outside of the spock domain.

Reply all
Reply to author
Forward
0 new messages