简体   繁体   中英

Proxy configuration in Eclipse Settings.xml

"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".

Question 1: Still could I be behind proxy? If yes how to get the information about proxy.

I learned that users>home>.m2>settings.xml needs to be updated with proxies. For ex:

<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.

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.

Question 1: Still could I be behind proxy? If yes how to get the information about proxy.

Assuming you are using Windows :

  1. Trigger Run command: Press Win + R , and type inetcpl.cpl , OK.
  2. Switch to Connections tab and press Lan settings button.
  3. Note down the Address and Port from "Proxy server" section.

Question 2: In this what do I substitute for my case in tag or where can I find information that is specific to myself.

Substitute the <host> and <port> in your settings.xml with Step 3 data.

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.

No. They are different. What mostly works in Eclipse is the Native network 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).

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 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 connections in 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).

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 -U flag . This flag forces Maven to update any dependencies. See this question for a way to do that in Eclipse.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM