Open mpe85 opened 4 years ago
Same problem as well. Tried with all plugin 5.0+ versions. Works well with Gradle 6.3 but breaks with 6.4 with the "'mainClass' is final and cannot be changed any further." error.
build.gradle.kts excerpt»:
application { mainClassName = "io.vertx.core.Launcher" } val mainVerticleName = "com.softjake.hpdg.spk01.MainVerticle" val vertxVersion = "3.8.4" ... java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } ...
@softjake, @mpe85
I have the following config: `application { version = appVersion mainClassName = appManifestAttributesMainClass // https://github.com/netty/netty/issues/9677 applicationDefaultJvmArgs = listOf("--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED") }
java {
sourceCompatibility = JavaVersion.VERSION_13
targetCompatibility = JavaVersion.VERSION_13
}
...
tasks.named
@robertnosko code formatting
The problem may be that in gradle 6.4 application plugin now moves mainClassName
getter and setter to a mainClass
attribute.
Setting the deprecated mainClassName
won't work on Gradle 7.0, because there its not present anymore.
In Kotlin Gradle DSL buidl script for Gradle 7.0 would look like:
application() {
mainClass.set("de.tfr.MainKt")
}
But then it's necessary like mentioned before to manually set the manifest attributes. This blows up the build file and is a pity, because the whole manifest
can be skipped, if the new mainClass
would be supported like the old mainClassName
.
I opened a separate ticket for that:
https://github.com/johnrengelman/shadow/issues/663
The plugin seems to be incompatible with Gradle 6.4. With previous version of Gradle (6.3 or lower) everything is fine.
Shadow Version
5.2.0
Gradle Version
6.4
Expected Behavior
runShadow
task should not failActual Behavior
Exception is raised:
Gradle Build Script(s)
Content of Shadow JAR (
jar tf <jar file>
- post link to GIST if too long)