Open dvlp-r opened 11 months ago
Any reason why you don't just use the intellij run icon next to main()?
If you still want/need to use gradle, you can reconfigure the build.gradle.kts and then use gradle run.
plugins {
kotlin("jvm") version "1.9.20"
application
}
application {
mainClass = "Day01Kt"
}
Hi @MaaxGr , thanks for your response. yes, sometimes I code in codespaces from iPad and I need to use command line. I knew this alternative but I was interested in knowing the underling command used by IntelliJ to build and run, without the need of modifying anything in the template, so to be able to use it both in intelllij and in other envs.
This template provides a minimal setup for running Advent of Code solutions via IDE.
Using @MaaxGr suggestion, we can go further and parametrize the mainClass
with:
plugins {
kotlin("jvm") version "1.9.20"
application
}
sourceSets {
main {
kotlin.srcDir("src")
}
}
application {
mainClass = providers.gradleProperty("day").map { "Day${it}Kt" }
}
tasks {
wrapper {
gradleVersion = "8.5"
}
}
and run it with:
./gradlew run -Pday="01"
I have the same usecase as @dvlp-r, using codespaces while on the run, so running the program through the CLI is essential. I like your suggestion @hsz.
Hi, I have downloaded your template and I am struggling about how to run the Day01.kt file from command line.
Gradle build -> gradle run does not work since there is no a run task in the build script.
Thank you in advance for your help.