0

I have the following multi-project structure (only the important parts are shown):

- project
    - build.gradle (file) 
    - settings.gradle (file)
    + module1 (dir)
    + module2 (dir)

build.gradle:

ext {
    groovyMajorVersion = 2.4
    groovyMinorVersion = 3
}
subprojects {
    dependencies {
        testCompile 'org.codehaus.groovy:groovy-all:${groovyMajorVersion}.${groovyMinorVersion}'
        testCompile 'org.spockframework:spock-core:1.0-groovy-${groovyMajorVersion}'
    }
}

settings.gradle:

include 'module1', 'module2'

When I run gradle dependencies from module1, I get the following error:

testCompile - Compile classpath for source set 'test'.
+--- org.codehaus.groovy:groovy-all:${groovyMajorVersion}.${groovyMinorVersion} FAILED
\--- org.spockframework:spock-core:1.0-groovy-${groovyMajorVersion} FAILED
Aliaksandr Kazlou
  • 3,221
  • 6
  • 28
  • 34

1 Answers1

2

This is because inside the dependencies block you're wrapping the dependencies with apostrophes (') rather than inverted commas ("), thus the parameters inside the dependencies do not get resolved. To fix, simply replace the the apostrophes with inverted commas, i.e.:

    testCompile "org.codehaus.groovy:groovy-all:${groovyMajorVersion}.${groovyMinorVersion}"
    testCompile "org.spockframework:spock-core:1.0-groovy-${groovyMajorVersion}"
Amnon Shochot
  • 8,998
  • 4
  • 24
  • 30
  • Amnon Shochot, you are right. It was due to my yesterday changes where I replaced all " into ', and completely forgot about Groovy string interpolation. Thank you. – Aliaksandr Kazlou May 21 '15 at 05:05