Before upgrading to gradle 3.4 I had a working configuration where my repository configuration was in a separate file and I could invoke it from my build script as follows
// repositories.gradle
RepositoryHandler.metaClass.myRepo = {
delegate.maven {
url "https://example.com/repo"
credentials {
username "user"
password "hunter2"
}
}
}
// build.gradle
buildscript {
apply from: "repositories.gradle"
repositories {
myRepo()
}
}
allprojects {
repositories {
myRepo()
}
}
After upgrading to gradle 3.4, ./gradlew build continued to work, but gradle sync in IntelliJ started to fail with the message
Gradle DSL method not found ‘myRepo()’
If it makes any difference, this is an Android project using version 2.3.0 of the Android gradle plugin.
I read the release notes, but nothing jumped out as the likely culprit.
How can I change my configuration to get gradle sync working again in 3.4+?