Problem
* What went wrong:
Execution failed for task ':JarHazardSyncWorker'.
> archive contains more than 65535 entries.
To build this archive, please enable the zip64 extension.
See: https://docs.gradle.org/7.6/dsl/org.gradle.api.tasks.bundling.Zip.html#org.gradle.api.tasks.bundling.Zip:zip64
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
...
...
...
...skip
Caused by: org.gradle.api.tasks.bundling.internal.Zip64RequiredException: archive contains more than 65535 entries.
To build this archive, please enable the zip64 extension.
Solution
build.gradle
task JarTestExample(type: Jar) {
zip64 = true // <-- Add this
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archivesBaseName = 'TestExample'
includeEmptyDirs = false
manifest {
attributes 'Main-Class': 'com.johnny.TestExample'
}
// remove the security files (from mail.jar / activation.jar) so that the jar will be executable.
from (configurations.implementation.collect { it.isDirectory() ? it : zipTree(it) }) {
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
}
from sourceSets.main.output
}