There is a Gradle 6.X multi-module project using Kotlin DSL.
buildSrc
feature is used to manage dependency versions in a central place. Something similar to the approach described here.
The project uses an internal server to download dependencies. It causes the duplication of the repository settings configuration in two places:
buildSrc/build.gradle.kts
:
plugins {
`kotlin-dsl`
}
repositories {
// The org.jetbrains.kotlin.jvm plugin requires a repository
// where to download the Kotlin compiler dependencies from.
maven {
url = uri("${extra.properties["custom.url"] as? String}")
credentials() {
username = extra.properties["custom.username"] as? String
password = extra.properties["custom.password"] as? String
}
}
}
and root settings.gradle.kts
:
...
gradle.projectsLoaded {
allprojects {
repositories {
maven {
url = uri("${extra.properties["custom.url"] as? String}")
credentials() {
username = extra.properties["custom.username"] as? String
password = extra.properties["custom.password"] as? String
}
}
}
}
}
...
Is it possible somehow to share the duplicated maven
block between these two places?