Could use a hand, does any one know why buildFatJa...
# ktor
g
Could use a hand, does any one know why buildFatJar seems to build the jar correctly but then it never runs, saying it can't find the main class, however runLocally runs fine locally? I'd prefer not to use shadow... my experience with gradle, if there is one thing I've learned, mixing plugins is futile and a brain murderer.
Copy code
register<Jar>("buildFatJar") {
    group = "application"
    manifest {
        attributes["Implementation-Title"] = "Gradle Jar File Example"
        attributes["Implementation-Version"] = archiveVersion
        attributes["Main-Class"] = "com.app.BackendAppKt"
    }
    archiveBaseName.set("${project.name}-fat")
    from(main.output.classesDirs, main.compileDependencyFiles)
    with(jar.get() as CopySpec)
}
register<JavaExec>("runLocally") {
    group = "application"
    setMain("com.app.BackendAppKt")
    classpath = main.output.classesDirs
    classpath += main.compileDependencyFiles
}
f
It's manifest.mf generated? Its contents match your config?
c
Shadow actually works really well with the kotlin plugin, both normal JVM plugin and Multiplatform plugin (using
jvm { withJava() }
). I’ve personally set it up many times, and it’s nearly trivial and works flawlessly. Have you actually tried using it?
g
Not sure what version you are using... anyway, the withJava was missing so that was a major issue along with others I documented here (second solution down: https://stackoverflow.com/questions/61245847/create-fat-jar-from-ktor-kotlin-multiplatform-project-with-kotlin-gradle-dsl I don' really understand what it is.