shadow: shadow jar with > 65535 files fails
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':xxxxx:shadowJar'.
> org.apache.tools.zip.Zip64RequiredException: archive contains more than 65535 entries.
To build this archive, please enable the zip64 extension.
See: http://gradle.org/docs/2.1/dsl/org.gradle.api.tasks.bundling.Zip.html#org.gradle.api.tasks.bundling.Zip:zip64
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
About this issue
- Original URL
- State: closed
- Created 12 years ago
- Reactions: 1
- Comments: 15
Commits related to this issue
- fix(build-jar): error on shadow jar with > 65535 files ref: https://github.com/johnrengelman/shadow/issues/107 — committed to zucchero-sintattico/piper-kt by manuandru 3 years ago
It’s on
shadowJaritself. TheShadowJarTaskclass extends Gradle’sJartask. So any properties on it are available: http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.bundling.Jar.htmlFor anyone using the Gradle Kotlin-DSL, the above answers result in the following:
for Kotlin DSL, if you applied
shadowusingpluginsblock now you can use the type-safe accessor forshadowJartask, it also uses lazy tasks API:if you happened to follow this tutorial: https://www.artificialworlds.net/blog/2019/07/12/building-an-all-in-one-jar-in-gradle-with-the-kotlin-dsl/
you can add setZip64(true) as shown below:
$ cat build.gradle.kts import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins { kotlin(“jvm”) version “1.3.41” id(“com.github.johnrengelman.shadow”) version “5.1.0” }
repositories { mavenCentral() }
dependencies { implementation(kotlin(“stdlib”)) }
tasks.withType<ShadowJar>() { setZip64(true) // new code manifest { attributes[“Main-Class”] = “HelloKt” } }
Have you tried enabling the
zip64option like the error says?I am seeing the following error: java.util.zip.ZipException: central directory zip64 extended information extra field’s length doesn’t match central directory data. Expected length 0 but is 16
Not sure how to solve this. Any help would be appreciated.
@pkallos Where did you add the zip64 configuration? Can you paste your build.gradle here?