Answer the question
In order to leave comments, you need to log in
How to create a task to run an application using Gradle Kotlin DSL?
Good afternoon.
Decided to try Gradle Kotlin DLS.
I have a program with several entry points, and to run them, I made separate tasks of the form:
task runMain(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = "ru.mipt.npm.mcengine.MainKt"
standardInput = System.in
}
tasks.create<JavaExec>("runMain"){
classpath = java.sourceSets["main"].runtimeClasspath
main = "ru.mipt.npm.mcengine.MainKt"
standardInput = System.`in`
}
Script compilation error:
Line 38: classpath = java.sourceSets["main"].runtimeClasspath
^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val Project.sourceSets: SourceSetContainer defined in org.gradle.kotlin.dsl
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question