Eclipse无法在公司代理后面更新Maven索引 [英] Eclipse fails to update Maven index while behind company proxy
问题描述
Eclipse Mars m2e插件无法在启动时下载存储库索引更新。我在公司防火墙后面运行Eclipse,但代理设置适用于检查更新,eclipse marketplace和eclipse的内置浏览器。
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.
我试过以下内容:
-
删除缓存目录
\ eclipse \p2 \org.eclipse。 equinox.p2.repository\cache
然后刷新存储库。首选项 - >安装更新 - >可用软件站点=>选择条目并单击重新加载
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"
添加 -Djava.net。 preferIPv4Stack = true
到eclipse.ini中的 -vmargs
Adding -Djava.net.preferIPv4Stack=true
to -vmargs
in eclipse.ini
编辑:$ HOME / .m2 / settings.xml中的代理配置已正确设置
修改似乎是错误。所以我用eclipse.org提出了一个错误请求。你可以在这里查看它。
Proxy configurations are correctly set in $HOME/.m2/settings.xml
Seems like a bug. So I raised a bug request with eclipse.org. You can view it here
由于这个问题,eclipse无法搜索并添加来自maven存储库的依赖项。
Due to this issue, eclipse fails to search and add dependency from maven repositories.
这是.metadata / .log中的错误
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)
推荐答案
我找到了解决方案。这很简单。经过一些代码调查后,我发现了以下内容:
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
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
所以m2e扫描代理列表并试图通过协议找到正确的。如果您查看中央网址: https://repo.maven.apache.org/maven2 。它从https开始。
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".
您的代理设置应该是这样的(http的一个代理和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>
这篇关于Eclipse无法在公司代理后面更新Maven索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!