Kotlin Spring Boot Deploy Issue

Hello, I'm trying to deploy a basic spring boot app using kotlin, gradle, and jdk 8. There are no special build instructions in my build.gradle.kts or railway service configuration. And I receive the error:
no main manifest attribute, in build/libs/api-0.0.1-SNAPSHOT-plain.jar
no main manifest attribute, in build/libs/api-0.0.1-SNAPSHOT-plain.jar
When I make the change to my build.gradle.kts to point to my main class file, I receive this error:
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at com.rpwadmin.api.BackendApplicationKt.main(BackendApplication.kt)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 1 more
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at com.rpwadmin.api.BackendApplicationKt.main(BackendApplication.kt)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 1 more
I've started from jdk 17 and gone all they way down and I can't seem to find a work around.
2 Replies
Percy
Percy16mo ago
Project ID: c78b6dc1-6ade-4474-9dac-6f53ae71e22c
mynameisjes
mynameisjesOP16mo ago
c78b6dc1-6ade-4474-9dac-6f53ae71e22c I guess there is kindof a work arround by making a "fatJar"
tasks.jar {
enabled = true
manifest {
attributes["Main-Class"] = "***"
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}
tasks.jar {
enabled = true
manifest {
attributes["Main-Class"] = "***"
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}
Want results from more Discord servers?
Add your server