[ad_1]
The official doco allows you to switch the examples between the Groovy and Kotlin DSLs. Currently the answer listed there to your question is:
repositories {
mavenCentral()
maven {
url = uri("<MAVEN REPO URL>")
}
}
I needed to add Gitlab with authentication, which has a more complicated syntax. For others that stumble upon this, here is the official Gitlab example translated to the kts/Kotlin syntax.
val gitLabPrivateToken: String by project
maven {
url = uri("https://<gitlab-url>/api/v4/groups/<group>/-/packages/maven")
name = "GitLab"
credentials(HttpHeaderCredentials::class) {
name = "Private-Token"
value = gitLabPrivateToken
}
authentication {
create<HttpHeaderAuthentication>("header")
}
}
The example URL here is true to Gitlab doco. But for me, it only worked with a URL like this:
https://gitlab.com/api/v4/projects/12345/packages/maven
[ad_2]