Ext property handling in version 1.11 changed?


(david koch) #1

Hello,

the following code does run with 1.10 and previous but not with 1.11.

From my perspective the ext.modules declaration is implicitly added to project and will be read from project again? But now it complains about missing ext property. Thank you, David

buildscript {scriptHandler->
  repositories{
    jcenter()
  }
   ext.modules = [
    log4j:
[group: 'log4j', name: 'log4j', version: '1.2.16']
   ]
  dependencies {
    classpath ext.modules.log4j
  }
}
task build{
}

(Jochen Berger) #2

I have a similar issue. You can temporarily work around this issue by changing ‘ext.modules.log4j’ to ‘modules.log4j’. See http://forums.gradle.org/gradle/topics/snapshot_compile_dependency_ends_up_with_different_versions_in_different_configurations.


(Peter Niederwieser) #3

I don’t know about the change, but ‘ext.’ should only be used when defining an extra property, not when reading it. Also, I would only use it for “public” properties. In the case above, a simple ‘def modules =’ would do.


(Luke Daley) #4

In Gradle 1.11, the ‘dependencies’ object now has its own ‘ext’ space. This means using ‘ext’ in that block now refers to this space and not the project space which is what you need in your example. This was an unintended change in Gradle 1.11.