Hello folks! Has anyone been able to configure the...
# gradle
x
Hello folks! Has anyone been able to configure the
ShadowJar
plug-in using Kotlin DSL? I'm using Vert.x with Kotlin and so far the
mergeServiceFiles
doesn't work; also I get some "unresolved reference" for
manifest.attributes
(you know, the red bulb on the right). This is what I got so far...
Copy code
plugins {
  ...
  id("com.github.johnrengelman.shadow") version "2.0.1"
}

tasks.withType<ShadowJar> {
  baseName = project.name
  classifier = "shadow" // fat, shadow
  manifest.attributes.apply {
    put("Application-Name", project.name)
    put("Gradle-Version", gradle.gradleVersion)
    put("Implementation-Version", "${project.version}")
    //put("Main-Class", "io.shido.MainVerticle")
    put("Main-Verticle", "io.shido.MainVerticle")
  }
  mergeServiceFiles({ include("META-INF/services/io.vertx.core.spi.VerticleFactory") })
  version = "${project.version}"
}
j
The
ShadowJar
task extends
Jar
so I think you can configure it like this: https://github.com/wpilibsuite/shuffleboard/blob/master/build.gradle.kts#L141-L146
x
As a reference, just in case someone else needs it, this is working:
Copy code
configure<ApplicationPluginConvention> {
  mainClassName = "io.vertx.core.Launcher"
}

tasks.withType<ShadowJar> {
  baseName = project.name
  classifier = "shadow" // fat, shadow
  manifest.attributes.apply {
    put("Application-Name", project.name)
    put("Build-Date", ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_DATE_TIME))
    //put("Build-Number", )
    put("Created-By", System.getProperty("user.name"))
    put("Gradle-Version", gradle.gradleVersion)
    put("Implementation-Version", "${project.version}")
    put("JDK-Version", System.getProperty("java.version"))
    //put("Main-Class", "io.shido.MainVerticle")
    put("Main-Verticle", "io.shido.MainVerticle") // This is your "entry" verticle, the one that deploys the others and things like that
  }
  mergeServiceFiles { include("META-INF/services/io.vertx.core.spi.VerticleFactory") }
  version = "${project.version}"
}