Search code examples
gradlegradle-kotlin-dsl

Gradle plugin configuration in kotlin script


I'm trying to configure Kotlin net.researchgate.release plugin. I have following setup (kts script):

plugins {
    ...
    id("net.researchgate.release") version "2.8.1"
}

In the same script I'm trying to configure plugin:

release {
    svn {
        username = "some"
        password = System.getenv("SOME")
        pinExternals = false
    }
}

During build I've got:

Unresolved reference: svn

How would I configure this plugin?


Solution

  • That plugin does not support the Kotlin DSL. The reason is that it uses Groovy meta-programming constructs to configure the nested extensions, and you are not using Groovy.

    There are two open issues for this problem: 281 and 288. The former suggests a few different work-arounds, including configuring the SVN adapter like this:

    release {
        with (propertyMissing("svn") as SvnAdapter.SvnConfig) {
            username = "some"
            // etc...
        }
    }