I want to create a function in the Gradle DSL, specifically in org.gradle.api.artifacts.dsl.RepositoryHandler
. I’m writing the plugin in Kotlin and releasing it to the gradle plugin portal.
fun RepositoryHandler.something(something: String) {
maven { repo ->
repo.name = something
repo.url = URI.create("https://something.test/$something")
repo.credentials { creds ->
creds.username = System.getenv("SOMETHING_USERNAME")
creds.password = System.getenv("SOMETHING_PASSWORD")
}
}
}
This works for build.gradle.kts
files, but not with Groovy. Is there a better to way to create it? If so, please guide me the right way! <3
This is used in build.gradle(.kts)? files:
repositories {
mavenCentral()
something("something")
}