spring

Gradle Kotlin Spring Boot BootJar mainClassName

What a header but to have it short: When you have problems with your generated bootjar using Gradle and Kotlin in combination with Spring Boot like the jar could not find any main class although you've already defined it when running the generated or things like that, then the solution is mostly pretty simple. You have to add "Kt" to the mainClassName definition like below

tasks {
    getByName<org.springframework.boot.gradle.tasks.bundling.BootJar>("bootJar") {
        classifier = "boot"
        mainClassName = "de.daill.SomeKotlinClassKt"
    }
}

After settings this the bootJar works just fine :)