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:
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