Reputation: 4539
I am trying to convert Gradle's Groovy DSL
to Kotlin DSL
Gradle Groovy Code is :
repositories {
maven {
url "https://repo.tools.telstra.com/repository/maven-public"
}
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
I am trying this to convert into Kotlin DSL
, like below:
repositories {
maven { url = ("https://repo.tools.telstra.com/repository/maven-public") }
mavenCentral()
maven { url = ('https://plugins.gradle.org/m2/') }
}
With that I am getting error as:
Type mismatch: inferred type is String but URI! was expected
How can I setup URI here?
Upvotes: 5
Views: 6914
Reputation: 124
The equivalent to Groovy DSL's
maven {
url "https://repo.tools.telstra.com/repository/maven-public"
}
In Kotlin DSL is:
maven("https://plugins.gradle.org/m2/")
Upvotes: 5
Reputation: 4539
At the moment I am using Gradle 6.9, there we have to write it like below:
repositories {
maven(url = uri("https://repo.tools.telstra.com/repository/maven-public"))
mavenCentral()
maven( url = uri("https://plugins.gradle.org/m2/"))
}
Upvotes: 8
Reputation: 63
This is already solved here How to add a maven repository by url using kotlinscript DSL (build.gradle.kts).
repositories {
maven { url = ("https://repo.tools.telstra.com/repository/maven-public") }
mavenCentral()
maven { url = ('https://plugins.gradle.org/m2/') }
}
In Kotlin DSL
would be
repositories {
mavenCentral()
maven ( url = "https://repo.tools.telstra.com/repository/maven-public" )
maven ( url = "https://plugins.gradle.org/m2/" )
}
Upvotes: 1