cedric
08/29/2019, 9:24 PMrun {}
(JavaExec
plug-in) in Gradle but in Kotlin? It can’t work out of the box since run
is part of the standard library, but even importing it and renaming it to _run
still won’t let me use Gradle’s run
symbol…serebit
08/29/2019, 9:26 PMtasks.withType<JavaExec> { }
cedric
08/29/2019, 9:30 PMtasks.withType<JavaExec> {
main = "com.beust.perry.MainKt"
args("server", "config.yml")
}
$ ./gradlew run
* What went wrong:
Execution failed for task ':run'.
> No main class specified and classpath is not an executable jar.
serebit
08/29/2019, 9:32 PMapplication { }
cedric
08/29/2019, 9:35 PMapplication {
mainClassName = "com.beust.perry.MainKt"
}
tasks.withType<JavaExec> {
args("server", "config.yml")
}
Why does JavaExec
have a main
attribute then if it’s ignored? Gradle baffles me.gildor
08/30/2019, 12:51 AMcedric
08/30/2019, 12:52 AMcedric
08/30/2019, 12:52 AM.gradle
to .gradle.kts
, I've found that sometimes foo{ }
works out of the box and other times, I have to do with(foo) { }
. Again, pretty baffled.gildor
08/30/2019, 1:22 AMgildor
08/30/2019, 1:23 AMtasks.named<JavaExec>("run") {}
gildor
08/30/2019, 1:23 AMgildor
08/30/2019, 1:24 AMrun
task name conflicts with Kotlin run
extension
There is a task about this somewhere on kotlin issue trackergildor
08/30/2019, 1:25 AM(tasks.run) { }
or
tasks.run.invoke { }
gildor
08/30/2019, 1:25 AMgildor
08/30/2019, 1:25 AMI have to doIn which cases do you have this?with(foo) { }