Enabling zip64 in micronaut project gradle

If you have landed on this article then probably you must be facing the following issue

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

All the library files are compiled to a single jar which is called as fat/uber jar. This is done by one of the plugin know as shadow

This library have an limitation that the number of files in that file should not be greater than 65535.

This limitation is solved by enabling a flag provide by the library that is zip64.

Add following lines in build.gradle

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

tasks.withType(ShadowJar) {
    setZip64(true)
}

Now you can build your project.

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *