Ray Rahke
03/15/2024, 10:48 AMbuild.gradle.kts
plugins {
kotlin("multiplatform") version "1.9.23"
application
}
repositories {
mavenCentral()
}
application {
mainClass.set("MainKt")
}
kotlin {
sourceSets {
val commonMain by getting {
kotlin.srcDir("src")
resources.srcDir("res")
dependencies {
/* ... */
}
}
}
}
directory structure
├── README.md
├── build
├── build.gradle.kts
├── gradle
│ ├── libs.versions.toml
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle.kts
└── src
└── main.kt
src/main.kt
fun main() {
println("Hello")
}
output of gradle run
> Task :run FAILED
Error: Could not find or load main class MainKt
Caused by: java.lang.ClassNotFoundException: MainKt
I have tried a few different combinations of folder structures and none work. the docs are super implicit and vague about how this works.simon.vergauwen
05/08/2024, 9:43 AM