Maven Archiver 在清单的类路径中添加奇怪的换行符
根据 java 规范,jar 的 manifest.mf 中的类路径行只能是一定数量的字节。之后插入换行符,新行以空格开始。
使用 Maven 3 和 maven-jar-plugin 版本 2.3.2,我的清单最终在类路径中出现了一些有趣的换行符,我认为在部署到 WAS 7 中时这可能会破坏我的 EAR。
只是想确保清单没问题看起来像这样(可能与字节长度不匹配,但你得到了图片):
Class-Path: log4j-1.2.16.jar projectthatislong-0.0.1-SNAPSHOT.jar projectt
hatislong-0.0.1-SNAPSHOT.jar
注意它是如何在第一行末尾的第三个项目的中间中断的?看来这也不是什么好事。有办法纠正这个问题吗?我不相信“customClasspathLayout”选项对我有用。
Per the java spec the classpath line in the manifest.mf for a jar can only be a certain number of bytes. After that a line break is inserted and the new line begins with an empty space.
Using Maven 3, and maven-jar-plugin version 2.3.2 my manifest ends up with some interesting line breaks in the classpath and I think that may be breaking my EAR when deployed into WAS 7.
Just want to make sure the manifest is OK to look like that (may not match byte length but so you get the picture):
Class-Path: log4j-1.2.16.jar projectthatislong-0.0.1-SNAPSHOT.jar projectt
hatislong-0.0.1-SNAPSHOT.jar
Notice how it breaks in the middle of the third project at the end of the first line? Seems like that would not be a good thing. Is there a way to correct this? I don't believe the "customClasspathLayout" option is going to work for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这符合 Java 清单文件规范。请注意,行长度为 72 个字符,如果超过该长度,则意味着在该点换行。
This is in line with the specification for Java manifest files. Note the line length is 72 characters, and if it exceeds that it is meant to wrap at that point.
我挣扎了大约8个小时。
即使您指定了自定义文件,Plexus 归档程序也始终会重新打包/重组您的 MANIFEST 文件。始终添加换行符(限制 72 个字符)
没有办法改变这种行为
plexus 存档器代码
我找到了以下解决方法。我开始使用 truezip-maven-plugin 来更新生成的ear:
I was struggling ~8 hours.
Plexus archiver always repacks/restructures your MANIFEST file if even you specify custom one. Line breaks are always added (72 chars limitation)
There is no way to change this behaviour
plexus archiver code
I found the following workaround. I started using truezip-maven-plugin to update generated ear: