How to add a maven repository by url using kotlinscript DSL (build.gradle.kts)

烂漫一生 提交于 2019-12-03 09:24:44

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>")
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!