has the way to build a shadowJar changed since gra...
# gradle
j
has the way to build a shadowJar changed since gradle 7.4 ? I'm running
gradle shadowJar
, but only getting a jar with a Manifest in it in my root
build.gradle.kts
, I have the shadow plugin
Copy code
plugins {

   ...
   val shadowVersion = "7.1.2"

   kotlin("multiplatform").version(kotlinVersion).apply(false)
   kotlin("plugin.serialization").version(kotlinVersion).apply(false)
   id("com.github.johnrengelman.shadow").version(shadowVersion).apply(false)
}
and then in my module
Copy code
plugins {
   application
   kotlin("plugin.serialization")
   kotlin("multiplatform")
   id("com.github.johnrengelman.shadow")
}

application {
	mainClass.set("com.blah.MyServer")
}
when running
gradle shadowJar
, I get a fatjar which only contains a manifest, nothing else, not even a class file, but when hitting run in IntelliJ, it runs perfectly fine. my jvm files are under
module/src/jvmMain/kotlin/com/blah/*.kt
what is the alternative to build fat jars? I've tried the zipping approach, but it too is doing the same
Copy code
tasks.named<Jar>("jar") {
   archiveFileName.set("foo.jar")
   manifest {
      attributes("Main-Class" to "com.blah.MyServer")
   }

   from(sourceSets.main.get().output)

   dependsOn(configurations.runtimeClasspath)
   from ({
      configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) }
   })
}
e
neither shadow nor application will work with kotlin.multiplatform out of the box
👍 1
j
found a workaround, adding withJava in the jvm block makes multiplatform generate shadow jars again
Copy code
jvm {
   compilations.all {
      kotlinOptions.jvmTarget = "17"
   }
   withJava()
}
680 Views