Gradle version
Gradle 8.2.1
build.gradle.kts
tasks.jar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
manifest.attributes["Main-Class"] = "zht.indi.Main"
from(configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) })
exclude("LICENSE.txt", "NOTICE.txt", "rootdoc.txt")
exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA")
exclude("META-INF/NOTICE", "META-INF/NOTICE.txt")
exclude("META-INF/LICENSE", "META-INF/LICENSE.txt")
exclude("META-INF/DEPENDENCIES")
}
参考
https://blog.csdn.net/setlilei/article/details/123173339