Whats the equivalent of the following code snippet from a build.gradle in a build.gradle.kts version?
repositories {
mavenCentral()
maven {
url '<MAVEN REPO URL>'
}
}
As an addition to the other answers, in #kotlin-dsl/256 shortcut methods were added to the various repository methods to do something like the following:
repositories {
mavenCentral()
maven(url = "<MAVEN REPO URL>")
}
According to the issue, this was added in the Kotlin DSL version 0.11.1. The 0.11.x versions were included in the Gradle 4.2 release.
To see the Gradle version you are running with your build when using the Gradle wrapper run ./gradlew --version.
Florian Reisinger
At 2018-01-13 the correct syntax is the following (instead of url, the function setUrl):
repositories {
mavenCentral()
maven {
setUrl("<MAVEN REPO URL>")
}
}
来源:https://stackoverflow.com/questions/48242437/how-to-add-a-maven-repository-by-url-using-kotlinscript-dsl-build-gradle-kts