如何通过代理使用Maven? [英] How do I use Maven through a proxy?

查看:79
本文介绍了如何通过代理使用Maven?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想分享我通过代理使用maven的经验.

I want to share my experience of using maven through a proxy.

您很可能会遇到异常和消息,例如:

You would most likely face exceptions and messages like:


repository metadata for: 'org.apache.maven.plugins' could not be retrieved from 
repository: central due to an error: Error transferring file: Connection refused: connect


[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-
plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its 
dependencies could not be resolved: Failed to read artifact descriptor for 
org.apache.maven.plugins:maven-clean-plugin:jar:2.5

如何配置Maven以使用代理服务器?

How to configure Maven to use proxy server?

推荐答案

最有可能是由两个问题引起的:

Those are caused most likely by 2 issues:

  1. 您需要将代理配置添加到settings.xml中.这是您的用户名字段中的一个技巧.确保它看起来像域\用户名.在此处设置域,并在该斜杠前加一个重要的'\'.您可能要使用<![CDATA []]>标签,如果您的密码包含非xml友好字符.
  2. 我注意到maven 2.2.0有时根本无法通过代理工作,而2.2.1可以正常工作.

如果省略其中一些-maven可能会失败,并显示随机错误消息.

If some of those are omitted - maven could fail with random error messages.

只希望我像我一样,已经使人们免于搜寻这个问题达6个小时之久.

Just hope I've saved somebody from googling around this issue for 6 hours, like I did.

这篇关于如何通过代理使用Maven?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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