Maven 在 Windows 上挂起
我正在尝试使用 maven (mvn) 构建一个项目。你可能知道(对于 以前使用过 mvn 的人),如果项目缺少任何依赖项 build,mvn 首先从某个地方(中央 我猜是存储库)。我的问题是,在 Windows 7 上,mvn 在运行期间挂起 这个下载阶段经常是不确定的。昨天,我有 等了10个小时才下载了一个小到300-400 kbs的依赖项。 有谁知道如何解决这个问题或者原因是什么?
谢谢,
I am trying to build a project using maven (mvn). As you might know (for
people who used mvn before), if the project is missing any dependencies to
build, mvn first downloads these dependencies from somewhere (central
repositories, I guess). My problem is that on Windows 7, mvn hangs during
this download phase non-deterministically and often. Yesterday, I have
waited for 10 hours to download a dependency as small as 300-400 kbs.
Does anybody know how to fix this or what is the reason?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
将
MAVEN_OPTS
设置为-Djava.net.preferIPv4Stack=true
为我解决了这个问题(此选项禁用 IPv6 并专门使用 AF_INET 套接字)。我发现 此解决方案作为Maven在使用java时卡在下载依赖项上的答案http://jira.codehaus.org 上的 7 问题。
另请参阅
[确认:感谢@David Hartveld 提供有关此问题的更多信息。 ]
Setting
MAVEN_OPTS
to-Djava.net.preferIPv4Stack=true
fixed this problem for me (This option disables IPv6 and uses AF_INET sockets exclusively).I found this solution as an answer to the Maven stuck on downloading dependencies when using java 7 issue on http://jira.codehaus.org.
See also
[ Ack: thanks @ David Hartveld for more info on this issue. ]
如果您正在运行 AVG,请尝试禁用它。
http://comments.gmane.org/gmane.comp.jakarta .turbine.maven.user/122046
If you are running AVG, try disabling it.
http://comments.gmane.org/gmane.comp.jakarta.turbine.maven.user/122046
我对此没有答案,但我不同意之前的评论。我也遇到了同样的问题。对于某些依赖项,我在多次重试后才能够完成下载。我这边的网络错误似乎不会导致这些症状。我怀疑镜子超载了。通过改用欧洲镜像,我成功地解决了剩余的依赖关系。我尝试从我所在的位置向东走,因为现在那里已经是半夜了。
I don't have an answer for this but I disagree with the previous comment. I was having the same problem. For some dependencies, I was able to finish the download after several retries. It doesn't seem like a networking error on my end would cause these symptoms. I suspect that the mirror is overloaded. I had success on the remaining dependencies by switching to European mirrors. I tried going East from my location since it's now the middle of the night there.
解决您的网络问题。如果下载失败/挂起,则说明 Maven 内没有任何内容。当它下载工件时,它会向您显示正在下载的 URL。您可以使用这些 URL 来解决您的问题。在浏览器中通过
wget
或其他方式尝试它们。Resolve your networking issues. If the downloads are failing/hanging, it's not anything inside Maven. When it downloads artifacts, it shows you the URLs being downloaded. You can use these URLs to troubleshoot your problems. Try them in a browser, from
wget
, or whatever.