I have something like this in my top level build.gradle (Gradle 2.2)
ext.repo = \"https://my-artifactory-repo\"
buildscript {
repositories
You can define your variable as an extra property with ext in the buildscript {...}. This variable is then also accessible in the scope of allprojects {...}:
buildscript {
ext {
repo = "https://my-artifactory-repo"
}
repositories {
maven {
url repo // works
}
}
}
allprojects {
repositories {
maven {
url repo // works
}
}
}