Maven 校验和失败
我正在开发一个使用 Maven 作为构建工具的项目。我使用的是该工具的 2.2.1 版本。最近,一位同事提到,由于校验和错误,他无法构建该项目。我没有收到这些错误,因此我删除了本地存储库。果然,我在下次尝试构建时也遇到了校验和错误。我们使用 Archiva 作为我们的中央存储库,因此我再次上传了 jar,希望能够解决该问题。运气不好。可能是什么原因导致这些错误以及如何解决这些错误?
Downloading: http://artifactory/archiva/repository/maven-repo/org/springframework/ws/spring-
ws/1.5.8/spring-ws-1.5.8.pom
427b downloaded (spring-ws-1.5.8.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '14d6901e3f251f5d312b9be726c75a
68f78045ac'; remote = '659bbed2c2dae12e9dbb65f8cad8fce1a1ea0845' - RETRYING
Downloading: http://artifactory/archiva/repository/maven-repo/org/springframework/ws/spring-
ws/1.5.8/spring-ws-1.5.8.pom
427b downloaded (spring-ws-1.5.8.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '14d6901e3f251f5d312b9be726c75a
68f78045ac'; remote = '659bbed2c2dae12e9dbb65f8cad8fce1a1ea0845' - IGNORING
Downloading: http://artifactory/archiva/repository/maven-repo/com/xyz/abc/3.0.20090929_
attachment_fixes/abc-3.0.20090929_attachment_fixes.pom
435b downloaded (abc-3.0.20090929_attachment_fixes.pom)
I am working on a project that uses Maven as the build tool. I am using version 2.2.1 of the tool. Recently a coworker mentioned that he couldn't build the project because of checksum errors. I wasn't getting these errors so I deleted my local repository. Sure enough, I also got the checksum errors on the next attempt to build. We are using Archiva as our central repository, so I uploaded the jars again hoping to resolve the issue. No luck. What could be causing these errors and how do I resolve them?
Downloading: http://artifactory/archiva/repository/maven-repo/org/springframework/ws/spring-
ws/1.5.8/spring-ws-1.5.8.pom
427b downloaded (spring-ws-1.5.8.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '14d6901e3f251f5d312b9be726c75a
68f78045ac'; remote = '659bbed2c2dae12e9dbb65f8cad8fce1a1ea0845' - RETRYING
Downloading: http://artifactory/archiva/repository/maven-repo/org/springframework/ws/spring-
ws/1.5.8/spring-ws-1.5.8.pom
427b downloaded (spring-ws-1.5.8.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '14d6901e3f251f5d312b9be726c75a
68f78045ac'; remote = '659bbed2c2dae12e9dbb65f8cad8fce1a1ea0845' - IGNORING
Downloading: http://artifactory/archiva/repository/maven-repo/com/xyz/abc/3.0.20090929_
attachment_fixes/abc-3.0.20090929_attachment_fixes.pom
435b downloaded (abc-3.0.20090929_attachment_fixes.pom)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
问题似乎在于 Maven 客户端如何将工件部署到中央存储库 (Archiva)。它使用 HTTP,在某些情况下会损坏文件的校验和签名。
尝试更改本地 Maven 设置文件,使其看起来像这样,对我来说,该文件位于
~/.m2/settings.xml
进行更改后,将工件重新部署到中央存储库,然后尝试在本地项目中运行
mvn dependency:resolve
以查看校验和错误是否仍然发生。这是关于此问题的线程: http://jira.codehaus.org/browse/MNG-4301
The problem appears to be in how the maven client is deploying artifacts to your central repository (Archiva). It's using HTTP and in certain situations will corrupt the checksum signature of the file.
Try changing your local maven settings file to look something like this, which for me was located in
~/.m2/settings.xml
After you make that change, redeploy the artifacts to your central repo, then try to run
mvn dependency:resolve
in your local project to see if the checksum errors still happen.Here's a thread about this problem: http://jira.codehaus.org/browse/MNG-4301
工件解析器(显然,即使在 3.0.4 中)也不是线程安全的:
http://jira .codehaus.org/browse/MNG-4742
尝试使用以下命令进行构建:
-Dmaven.artifact.threads=1
当我在 3.0.4 中使用此选项在显示校验和错误(对于 log4j)的项目中进行构建时,所有校验和错误消失。
它也应该适用于 2.2.1。
(编辑:将此答案归档在“隐藏误报”下)
The artifact resolver is (still, even in 3.0.4 apparently) not thread safe:
http://jira.codehaus.org/browse/MNG-4742
try building with:
-Dmaven.artifact.threads=1
When I build with this option in 3.0.4 in a project that displays checksum errors (for log4j), all of the checksum errors disappear.
It should apply to 2.2.1 as well.
(edit: file this answer under 'hiding false negatives')
您是否尝试更改 代理连接器到“修复”而不是“忽略”?
Did you try to change the Checksum policies in the proxy connector to 'fix' instead of 'ignore'?
我手动从 Archiva 中删除了工件,然后使用 Archiva 再次上传它们。这解决了我的问题。 Archiva 中的版本似乎存在重复的 POM、JAR 等,导致校验和错误。
I manually deleted the artifacts from Archiva and used Archiva to upload them again. This solved my problem. There appeared to be duplicate POMs, JARs, etc in Archiva for the versions that were giving the checksum errors.
虽然按照下面的 Rondo 描述使用单线程允许构建完成且没有错误,但最终我发现我的工作空间已损坏。可能是由于构建中断。我清理了工作空间并从源代码管理器创建了一个干净的工作空间,一切又恢复正常了。
While using a single thread as described bu Rondo below allowed the build complete without error, in the end I found that my work space was corrupted. Possibly due to an interrupted build. I wiped out the work space and created a clean one from the source code manager and everything worked fine again.