Search code examples
gradlegradle-kotlin-dsl

How to get runtime classpath in gradle kts script?


In gradle script I can do sourceSets.main.runtimeClasspath to get the runtime classpath. But in kts script it complains

Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public val NamedDomainObjectContainer<Configuration>.runtimeClasspath: NamedDomainObjectProvider<Configuration> defined in org.gradle.kotlin.dsl

How can I do it in kts script?


Solution

  • It turns out that I need sourceSets["main"].runtimeClasspath . Not sure if it is the most idiomatic way