Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add new configuration with Gradle Kotlin-dsl

with gradle-groovy it is possible to create a new configuration with:

configurations {
    explode
}

dependencies {
    explode (group: 'org.apache.samza', name: 'samza-shell', ext: 'tgz', classifier: 'dist', version: "$SAMZA_VERSION")
}

But I don't know how to do that with the kotlin-dsl. I tried:

val explode by configurations
    
dependencies {
    explode(group = "org.apache.samza", name = "samza-shell",  ext = "tgz", classifier = "dist", version = samzaVersion)
    // "explode"(group = "org.apache.samza", name = "samza-shell",  ext = "tgz", classifier = "dist", version = samzaVersion)
}

but without success. Any ideas?

like image 481
guenhter Avatar asked Sep 25 '17 09:09

guenhter


People also ask

How do I enable Kotlin DSL?

To activate the Kotlin DSL, simply use the . gradle. kts extension for your build scripts in place of . gradle .

What is DSL in Gradle?

Simply, it stands for 'Domain Specific Language'. IMO, in gradle context, DSL gives you a gradle specific way to form your build scripts. More precisely, it's a plugin-based build system that defines a way of setting up your build script using (mainly) building blocks defined in various plugins.


1 Answers

Could you please try:

val explode by configurations.creating

or:

val explode = configurations.create("explode")

The following build.gradle.kts script works fine:

repositories {
    mavenCentral()
}

val explode by configurations.creating

dependencies {
    explode("org.apache.samza:samza-shell:0.13.1")
}
like image 81
Opal Avatar answered Sep 28 '22 05:09

Opal