How do I configure the working directory of the ru...
# gradle
e
v
What does the IDE say the type is in that closure?
Seems to be
KotlinJvmRunDsl
which only allows to configure main class, arguments and classpath, so probably not from there. But you can probably directly configure the carrier task like
Copy code
val jvmRun by tasks.existing(JavaExec::class) {
    workingDir = ...
}
e
That gives me
Task with name 'jvmRun' not found in project
I placed it in an
afterEvaluate {}
inside
jvm().mainRun{ }
and that seems to do the job
v
afterEvaluate
is evil, don't use it if avoidable. It's main effect is introducing timing problems, ordering problems, and race conditions, while usually just doing symptom treatment.
Copy code
tasks.withType<JavaExec>().matching { it.name == "jvmRun" }.configureEach { workingDir = ... }
e
I am not surprised
this works! Thanks @Vampire!
👌 1