Is it possible to reuse the repository objects once they are set up?
I often find myself setting up repositories three times: Once for the buildscript block Once for the repositories block Once for the publishing block.
This seems silly. Ideally, you would be able to simply reference one object
buildscript {
repositories {
maven {
name "repo1"
url "someURL"
}
maven {
name "repo2"
url "anotherURL"
credentials {
username //... and so on
}
}
}
}
//Ideally you could do this, instead of duplicate the entire block
allprojects {
repositories {
use "repo1" "repo2"
}
publishing.repositories {
use "repo2"
}
}
Alternatively, something like: publishing.repositories = buildscript.repositories
Anything like this possible? I’ve been unable to find any way to do this besides maybe making a closure, which isn’t really reuse, just running the codeblock multiple times