1

Eclipse Mars m2e plugin fails to download repository index updates on startup. I run Eclipse behind a company firewall but the proxy settings work fine for "check for updates", "eclipse marketplace", and eclipse's built-in browser.

I have tried the following:

  1. Deleting the cache directory \eclipse\p2\org.eclipse.equinox.p2.repository\cache and then refreshing the repositories. Preferences -> Install Update -> Available Software Sites => select the entry and click "Reload"

  2. Adding -Djava.net.preferIPv4Stack=true to -vmargs in eclipse.ini

Edit: Proxy configurations are correctly set in $HOME/.m2/settings.xml
Edit: Seems like a bug. So I raised a bug request with eclipse.org. You can view it here

Due to this issue, eclipse fails to search and add dependency from maven repositories.

Here is the error in .metadata/.log

eclipse.buildId=4.5.0.I20150603-2000
java.version=1.8.0_60
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_IN
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

!ENTRY org.eclipse.m2e.logback.appender 4 0 2015-09-30 14:39:59.820
!MESSAGE Unable to update index for central|https://repo.maven.apache.org/maven2
!STACK 0
java.net.ConnectException: Connection timed out: connect
        at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at com.squareup.okhttp.internal.Platform.connectSocket(Platform.java:107)
        at com.squareup.okhttp.Connection.connect(Connection.java:156)
        at com.squareup.okhttp.Connection.connectAndSetOwner(Connection.java:175)
        at com.squareup.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:120)
        at com.squareup.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:330)
        at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:319)
        at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:241)
        at com.squareup.okhttp.Call.getResponse(Call.java:271)
        at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:228)
        at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:199)
        at com.squareup.okhttp.Call.execute(Call.java:79)
        at io.takari.aether.okhttp.OkHttpAetherClient.execute(OkHttpAetherClient.java:154)
        at io.takari.aether.okhttp.OkHttpAetherClient.get(OkHttpAetherClient.java:100)
        at org.eclipse.m2e.core.internal.index.nexus.AetherClientResourceFetcher.retrieve(AetherClientResourceFetcher.java:79)
        at org.apache.maven.index.updater.AbstractResourceFetcher.retrieve(AbstractResourceFetcher.java:35)
        at org.apache.maven.index.updater.DefaultIndexUpdater.downloadIndexProperties(DefaultIndexUpdater.java:452)
        at org.apache.maven.index.updater.DefaultIndexUpdater.access$100(DefaultIndexUpdater.java:75)
        at org.apache.maven.index.updater.DefaultIndexUpdater$IndexAdaptor.setProperties(DefaultIndexUpdater.java:607)
        at org.apache.maven.index.updater.DefaultIndexUpdater.fetchAndUpdateIndex(DefaultIndexUpdater.java:788)
        at org.apache.maven.index.updater.DefaultIndexUpdater.fetchAndUpdateIndex(DefaultIndexUpdater.java:135)
        at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager.updateRemoteIndex(NexusIndexManager.java:1127)
        at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager.updateIndex(NexusIndexManager.java:1084)
        at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager$1.run(NexusIndexManager.java:656)
        at org.eclipse.m2e.core.internal.index.nexus.IndexUpdaterJob.run(IndexUpdaterJob.java:72)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
Kiran Mohan
  • 2,696
  • 6
  • 36
  • 62
  • If you are using corporate internet, your employer may be analyzing your web traffic and using self-signed certificates. (See [Is it common practice for companies to MITM HTTPS traffic?](https://security.stackexchange.com/q/107542/141087)) To confirm if this is the case, open Firefox to an HTTPS site, click the lock icon in the adddress bar, and click the arrow to view more details. If it says "Verified by ", then it's an HTTPS issue. – Stevoisiak Oct 06 '17 at 14:31

3 Answers3

2

I've found solution. It's quite simple. After some code investigation I've found following thing: https://github.com/eclipse/m2e-core/blob/releases/1.6/1.6.2.20150902-0002/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/MavenImpl.java#L1226

So m2e scans proxy list and trying to find correct by protocol. If you look at central url: https://repo.maven.apache.org/maven2. It's starts from "https".

Your proxy settings should looks like that (one proxy for http and second for https):

<proxies>
  <proxy>
    <active>true</active>
    <protocol>http</protocol>
    <host>myproxy.company.com</host>
    <port>8080</port>
  </proxy>
    <proxy>
      <active>true</active>
      <protocol>https</protocol>
      <host>myproxy.company.com</host>
      <port>8080</port>
    </proxy>
</proxies>
Denis
  • 196
  • 1
  • 10
0

Although you have configured proxy in eclispe, you have to do the same config for maven, into settinggs.xml file. Here you have my proxy configuration section:

<proxies>
  <proxy>
    <active>true</active>
    <protocol>http</protocol>
    <host>myproxy.company.com</host>
    <port>8080</port>
  </proxy>
</proxies>

Then you have to ensure in eclipse that you are using the configured settings.xml file, in window->preferences-maven->user settings.

Hope it helps.

malaguna
  • 4,183
  • 1
  • 17
  • 33
  • Proxy configurations are correctly set in $HOME/.m2/settings.xml – Kiran Mohan Sep 30 '15 at 09:54
  • So, what happens if you run `mvn compile` from console? Does it work this way? – malaguna Sep 30 '15 at 09:56
  • If maven works ok, and eclipse points to the same `settings.xml` ... can you launch `reindex` button from `window`->`preferences`-`maven`->`user settings`? what happens? – malaguna Sep 30 '15 at 10:00
  • Failed. `!MESSAGE Updating the index from remote failed. Version: 1.0.0.v20150617-0732 !STACK 0 org.apache.http.conn.HttpHostConnectException: Connect to dev.eclipse.org:443 [dev.eclipse.org/198.41.30.200] failed: Connection timed out: connect` – Kiran Mohan Sep 30 '15 at 10:06
  • Sorry, I can't understand why it is trying to access `dev.eclipse.org`, it make no sense for me. Connection time out points to proxy error, but if everything is right configured, I can not figure out what's happen. – malaguna Sep 30 '15 at 10:12
0

Maven uses its own proxy settings, defined in .m2/settings.xml. You can find the settings used my m2e plugin in Eclipse's menu: Windows / Preferences / Maven / User Settings. Remember to hit the Update Settings -button after editing:

<!-- proxies
 | This is a list of proxies which can be used on this machine to connect to the network.
 | Unless otherwise specified (by system property or command-line switch), the first proxy
 | specification in this list marked as active will be used.
 |-->
<proxies>
  <!-- proxy
   | Specification for one proxy, to be used in connecting to the network.
   |
  <proxy>
    <id>optional</id>
    <active>true</active>
    <protocol>http</protocol>
    <username>proxyuser</username>
    <password>proxypass</password>
    <host>proxy.host.net</host>
    <port>80</port>
    <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
  </proxy>
  -->
</proxies>
janih
  • 2,214
  • 2
  • 18
  • 24