Hi!
We have several repositories, and to avoid copy-pasting we have another repository with common gradle files (used as apply from: ".../foo.groovy"
). The problem is that every build.gradle
and every common gradle file have the same buildscripts.repositories and repositories blocks.
I have used this topic to create a helper method (myrepo()
) that can be used inside buildscripts.repositories and repositories blocks. It works fine for build.gradle
but not for common gradle files. I’ve tried both
buildscript {
apply from: "$rootDir/src/main/gradle/myrepo.groovy"
repositories { myrepo() }
}
and
buildscript {
apply from: "$rootDir/src/main/gradle/myrepo.groovy"
repositories { project.buildscript.repositories.ext.myrepo() }
}
In the 1st case myrepo()
is not defined, in the 2nd no repositories are actually defined.
Is it possible to achieve required? Or, for example, define repos only in build.gradle
and not in files applied using apply from
?