Search code examples
gradlegradle-kotlin-dsl

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?


Solution

  • 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")
    }