Some time ago I created a gradle-based project in IntelliJ to play around. I added a few Kotlin and java classes in "main", and a single java class in "test".
Now IntelliJ suggests that I can run that test class. But there is no option to "run" a new Kotlin main() that I just added in a new .kt file in the main section.
Things compile fine, but no indication whatsoever that I could "run" that main method.
I see this question, but that is for a pure Kotlin project.
I had a look into "Run/Debug" configurations. In the templates, there is one Kotlin. When I use that, I can use the file chooser to look at my Kotlin classes; down to the main method. But the "OK" button is disabled, so I can't select anything as "run" target.
I figured that I can run one of my java classes by adding this task
task execute(type:JavaExec) {
main = 'com.whatever.Hello'
classpath = sourceSets.main.runtimeClasspath
}
and then I can run gradle[execute]. But When I point main to one of my Kotlin classes, I get
Task :execute FAILED
Error: Could not find or load main class com.whatever.TheKotlinClass