I'm switching from groovy to Kotlin dsl (build.gradle.kts) for Gradle builds. My publish artifact depends on my custom task. And I do not understand how to make this dependency in Kotlin dsl.
Original groovy code that I like to migrate to Kotlin dsl:
publish.dependsOn doSomething
Tasks that I am trying to chain:
val doSomething by tasks.creating(ShellExec::class) {
command = "./do-something"
}
publishing {
repositories {
maven {
...
}
}
publications {
register("mavenJava", MavenPublication::class) {
...
}
}
}
Can do it like this
tasks.withType<PublishToMavenRepository> {
dependsOn("doSomething")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With