Can I specify which main method to run from the command line?

Thank you! That was enough to make it work. I added

application {
    if (hasProperty("launch")) {
        mainClass.set("${property("launch")}Kt")
    }
}

to my build.gradle.kts and then I can do ./gradlew run -Plaunch=Hello1 or ./gradlew run -Plaunch=org.foo.Bar to start various programs :slight_smile:

3 Likes