Reputation: 169
I have defined an ext variable in build.gradle:
ext {
foo = "myVersion"
}
I would like to use this variable in settings.gradle, below options are not working:
plugins {
id("myPlugin").version("${foo}")
id("myPlugin").version(gradle.ext.foo)
id("myPlugin").version(gradle.foo)
id("myPlugin").version(foo)
id("myPlugin").version(project.foo)
id("myPlugin").version(rootProject.foo)
}
How to do that properly? Based on documentation settings.gradle is loaded while initialisation and probably it won't work that way I want.
Upvotes: 3
Views: 1859
Reputation: 2438
The settings file is applied before the build.gradle; so you can not use the variables that way. try using the gradle.properties
Upvotes: 6