egorand
05/02/2020, 5:36 PMmain()
function, located in a file inside the common module, in the IDE?saket
05/02/2020, 5:38 PMegorand
05/02/2020, 5:39 PMsaket
05/02/2020, 5:57 PMsaket
05/02/2020, 6:01 PMegorand
05/02/2020, 6:04 PMegorand
05/02/2020, 6:04 PMsaket
05/02/2020, 6:06 PMegorand
05/02/2020, 6:08 PMjvmMain
in Use classpath of module
saket
05/02/2020, 6:09 PMrusshwolf
05/02/2020, 6:36 PMI’m actually not sure if there’s a Gradle task that gets generated if I add a main method to a Kotlin fileThere isn’t one automatically, but you can configure one if you want. On JVM you can use the
application
plugin like you would for non-MPP. On JS the browser()
and nodejs()
configurations add run tasks. On native you can do binaries { executable { ... } }
and point it at your main function.egorand
05/02/2020, 7:25 PMJohn O'Reilly
05/03/2020, 10:27 AMapplication
plugin). I've done that for example in https://github.com/joreilly/PeopleInSpace/blob/master/common/src/jvmMain/kotlin/com/surrus/Main.kt . With that I see run icon to left of main
and am able to just run that then in IDE.John O'Reilly
05/03/2020, 10:36 AMegorand
05/04/2020, 5:28 PMjvmMain
for the sole reason of executing the common code with the Run button.egorand
05/04/2020, 5:30 PMmain()
method inside the common module using the gutter icon, you just need to manually tweak the run configuration.russhwolf
05/04/2020, 5:31 PMrusshwolf
05/04/2020, 5:32 PM