Thanks a lot Peter we found out final solution.
Summary for others:
‘gradle/alt-repo.gradle’:
repositories.ext.altRepo = {
if (System.getenv('ALT_REPO')) {
repositories.maven { url "file://${System.getenv('ALT_REPO')}" }
}
}
project.buildscript.repositories.ext.altRepo = {
if (System.getenv('ALT_REPO')) {
project.buildscript.repositories.maven { url "file://${System.getenv('ALT_REPO')}" }
}
}
‘build.gradle’:
apply from: "$rootDir/gradle/alt-repo.gradle"
buildscript {
apply from: "$rootDir/gradle/alt-repo.gradle"
repositories {
altRepo()
...
}
dependencies {
classpath "my:plugin:v1"
}
}
repositories {
altRepo()
...
}
apply plugin: 'my-plugin'
It is fantastic. I believed it is possible to do it.
Thanks a lot again. -libor