使用Maven-assembly-plugin创建一个大型zip程序集 [英] Create a large zip assembly with maven-assembly-plugin

查看:114
本文介绍了使用Maven-assembly-plugin创建一个大型zip程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用maven-assembly-plugin创建更大的zip程序集(未压缩占用3GB)时遇到问题.构建输出zip文件(压缩小于1GB)时,会发生此问题.使用选项-e运行maven可为我提供更详细的信息:

I'm having a problem with creating a larger zip assembly (uncompressed takes over 3GB) using maven-assembly-plugin. The problem occurs when building the output zip file (compressed less than 1GB). Running maven with option -e gives me a more detailed info:

[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中缺少对Zip64的支持( https ://blogs.oracle.com/xuemingshen/entry/zip64_support_for_4g_zipfile ),该文件已于2011年添加到OpenJDK中.

Looking around I found that the issue comes from missing support for Zip64 in my JDK/JRE (https://blogs.oracle.com/xuemingshen/entry/zip64_support_for_4g_zipfile), which was added to OpenJDK in 2011.

但是,我已将JDK更新为Oracle提供的最新版本:

However, I've updated my JDK to the newest one provided by 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?

and it reports the same issue, again. Does the newest Oracle JDK have no support for Zip64 or it's something else?

我想,我可以尝试从源代码构建OpenJDK b147,但除非不可避免,否则我想避免这种情况.

I guess, I could try building OpenJDK b147 from sources but would like to avoid that unless inevitable.

推荐答案

我找到了罪魁祸首,因此报告此问题只是为了节省其他人的时间.

I found the culprit, so reporting the issue just to save others time.

问题似乎出在我的异常堆栈跟踪中报告的org.codehaus.plexus.archiver.zip.ZipOutputStream.closeEntry(ZipOutputStream.java:352)中.查看org.codehaus...ZipOutputStream.closeEntry的来源,我可以看到:

It seems that the problem lays in org.codehaus.plexus.archiver.zip.ZipOutputStream.closeEntry(ZipOutputStream.java:352) as reported in my exception stack trace. Looking at the sources of org.codehaus...ZipOutputStream.closeEntry I can see:

entry.setSize( def.getTotalIn() );

,而defjava.util.zip.Deflater.但是,Deflater.getTotalIn返回int而不是long.相反,代码应使用Deflater.getBytesRead(),我要向开发人员报告.

and that def is java.util.zip.Deflater. However, Deflater.getTotalIn returns int not long. Instead the code should use Deflater.getBytesRead() which I'm gonna report to the developers.

已经有一段时间了,但是我看到有人读过这篇文章,所以自从maven程序插件的2.5版本以来,问题已得到解决.

It's been a while but I see people reading this, so FYI the problem has been fixed since version 2.5 of the maven assembly plugin.

这篇关于使用Maven-assembly-plugin创建一个大型zip程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆