我在使用 maven-assembly-plugin 创建更大的 zip 程序集(未压缩超过 3GB)时遇到问题。构建输出 zip 文件(压缩小于 1GB)时会出现问题。使用选项运行 maven 可以-e
为我提供更详细的信息:
[INFO] Building zip: xxx/HG19-UCSC-dist.zip
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12:40.199s
[INFO] Finished at: Wed Oct 02 11:08:44 BST 2013
[INFO] Final Memory: 13M/723M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (make-assembly) on project HG19: Execution make-assembly of goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single failed: invalid entry size -> [Help 1]
...
...
...
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution make-assembly of goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single failed: invalid entry size
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.IllegalArgumentException: invalid entry size
at java.util.zip.ZipEntry.setSize(ZipEntry.java:135)
at org.codehaus.plexus.archiver.zip.ZipOutputStream.closeEntry(ZipOutputStream.java:352)
at org.codehaus.plexus.archiver.zip.ZipOutputStream.finish(ZipOutputStream.java:316)
环顾四周,我发现问题出在我的 JDK/JRE ( https://blogs.oracle.com/xuemingshen/entry/zip64_support_for_4g_zipfile ) 中缺少对 Zip64 的支持,该支持是 2011 年添加到 OpenJDK 的。
但是,我已将我的 JDK 更新为 Oracle 提供的最新版本:
$ mvn -version
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 03:15:32+0100)
Maven home: /usr/local/apache-maven-3.1.0
Java version: 1.7.0_40, vendor: Oracle Corporation
Java home: /usr/local/java/jdk1.7.0_40/jre
Default locale: en_GB, platform encoding: ISO-8859-1
OS name: "linux", version: "2.6.32-279.2.1.el6.x86_64", arch: "amd64", family: "unix"
它再次报告了同样的问题。最新的 Oracle JDK 是否不支持 Zip64 或其他?
我想,我可以尝试从源代码构建 OpenJDK b147,但除非不可避免,否则我想避免这种情况。