Eclipse Settings.xml 中的代理配置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29046903/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Proxy configuration in Eclipse Settings.xml
提问by JavaProgrammer
"Failure to transfer org.apache.maven.plugins:maven-failsafe-plugin:pom:2.16 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will
not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-failsafe-
plugin:pom:2.16 from/to central (http://repo.maven.apache.org/maven2): proxy.example.com"
I am getting the above error in pom tag. I searched and found out this is due to proxy settings issue. But whatismyip.com shows "no proxy detected".
我在 pom 标签中收到上述错误。我搜索并发现这是由于代理设置问题。但是 whatismyip.com 显示“未检测到代理”。
Question 1:Still could I be behind proxy? If yes how to get the information about proxy.
问题 1:我还能落后于代理吗?如果是,如何获取有关代理的信息。
I learned that users>home>.m2>settings.xml needs to be updated with proxies. For ex:
我了解到 users>home>.m2>settings.xml 需要用代理更新。例如:
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<username>tomcat</username>
<password>tomcat</password>
<host>proxy.example.com</host>
<port>8008</port>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
Question 2:In this what do I substitute for my case in tag or where can I find information that is specific to myself.
问题 2:在此我用什么来替代标签中的案例或在哪里可以找到特定于我自己的信息。
Question 3:Is there any correlation between users>home>.m2>settings.xml andeclipse window>preferences>general>network Connections>Active Provider(Manual)>http. Do I need to update the same information in both places.
问题3:users>home>.m2>settings.xml和eclipse window>preferences>general>network Connections>Active Provider(Manual)>http有没有关联。我是否需要在两个地方更新相同的信息。
回答by KrishPrabakar
Question 1:Still could I be behind proxy? If yes how to get the information about proxy.
问题 1:我还能落后于代理吗?如果是,如何获取有关代理的信息。
Assuming you are using Windows:
假设您使用的是Windows:
- TriggerRun command: Press Win+R, and type
inetcpl.cpl
, OK. - Switchto
Connections
tab and pressLan settings
button. - Note downthe Address and Port from "Proxy server" section.
- 触发运行命令:按Win+ R,然后键入
inetcpl.cpl
OK。 - 切换到
Connections
选项卡并按下Lan settings
按钮。 - 记下“代理服务器”部分的地址和端口。
Question 2:In this what do I substitute for my case in tag or where can I find information that is specific to myself.
问题 2:在此我用什么来替代标签中的案例或在哪里可以找到特定于我自己的信息。
Substitute the <host>
and <port>
in your settings.xml
with Step 3data.
替代<host>
和<port>
在settings.xml
与第3步的数据。
Question 3:Is there any correlation between users>home>.m2>settings.xml and eclipse window>preferences>general>network Connections>Active Provider(Manual)>http. Do I need to update the same information in both places.
问题3:users>home>.m2>settings.xml 和eclipse window>preferences>general>network Connections>Active Provider(Manual)>http 有没有关联。我是否需要在两个地方更新相同的信息。
No.They are different. What mostly works in Eclipse is the Nativenetwork connection mode: Window > Preferences > General > Network Connections > Active Provider > Native
. This makes Eclipse to use your native browser's settings (IE in case of Windows).
不,它们是不同的。在 Eclipse 中最有效的是Native网络连接模式:Window > Preferences > General > Network Connections > Active Provider > Native
. 这使 Eclipse 使用您的本机浏览器的设置(在 Windows 的情况下为 IE)。
回答by Tunaki
There are various sites to check if you are behind a proxy or not. However, if you are behind then it must be configured in your browser; check there to see all the information about it.
有各种站点可以检查您是否支持代理。但是,如果您落后,则必须在浏览器中进行配置;检查那里以查看有关它的所有信息。
There is a difference about the settings.xml
file of Maven and network connections of Eclipse.
settings.xml
Maven的文件和Eclipse的网络连接是有区别的。
settings.xml
is a Maven-specific file. Whenever Maven (and Eclipse through the m2e plugin) will be searching for a dependency, it will use the proxy information located in this file.- Network connectionsin Eclipse is Eclipse-specific. It tells Eclipse about the proxy information when it want to connect to the Internet (through updates or marketplace). You can configure Eclipse to use the proxy information of your OS (typically Internet Explorer proxy settings on Windows machine).
settings.xml
是特定于 Maven 的文件。每当 Maven(以及通过 m2e 插件的 Eclipse)搜索依赖项时,它都会使用位于此文件中的代理信息。- Eclipse 中的网络连接是特定于 Eclipse 的。当 Eclipse 想要连接到 Internet(通过更新或市场)时,它会将代理信息告知 Eclipse。您可以将 Eclipse 配置为使用操作系统的代理信息(通常是 Windows 机器上的 Internet Explorer 代理设置)。
Also, the error message you have (Failure to transfer ... from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
), this is a very well known issue and it is solved by launching Maven with the -Uflag. This flag forces Maven to update any dependencies. See this questionfor a way to do that in Eclipse.
此外,您收到的错误消息 ( Failure to transfer ... from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
),这是一个众所周知的问题,可以通过使用-U标志启动 Maven 来解决。此标志强制 Maven 更新任何依赖项。有关在 Eclipse 中执行此操作的方法,请参阅此问题。