如何在gradle kts脚本中获取运行时类路径?

Jas*_*Lee 3 gradle gradle-kotlin-dsl

在 gradle 脚本中,我可以sourceSets.main.runtimeClasspath获取运行时类路径。但在 kts 脚本中它抱怨

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
Run Code Online (Sandbox Code Playgroud)

我怎样才能在kts脚本中做到这一点?

Jas*_*Lee 6

事实证明我需要sourceSets["main"].runtimeClasspath。不确定这是否是最惯用的方式