I am have a java application that has multiple main classes, the build.gradle is written in kotlin and named build.gradle.kts
It is failing with error Build failed with an exception
Script compilation errors:
Line 50: task(runSimple, dependsOn: "classes", type: JavaExec) {
Expecting ')'
I can solve the problem by using build.gradle as shown in Gradle application plugin with multiple main classes
but team want to stay with kotlin
apply plugin: 'java'
task(runSimple, dependsOn: 'classes', type: JavaExec) {
main = 'com.mrhaki.java.Simple'
classpath = sourceSets.main.runtimeClasspath
args 'mrhaki'
systemProperty 'simple.message', 'Hello '
}
is the code when build.gradle is used and it does work,
but
plugins {
java
application
}
task(runSimple, dependsOn: 'classes', type: JavaExec) {
main = 'com.mrhaki.java.Simple'
classpath = sourceSets.main.runtimeClasspath
args 'mrhaki'
systemProperty 'simple.message', 'Hello '
}
does not work
It should be able to run the class com.mrhaki.java.Simple but does not
I guess the kotlin translation is not correct.