eclipse 强制 m2e 使用 http 而不是 https
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32050244/
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
Force m2e to use http instead of https
提问by calaedo
My eclipse installation always uses the https protocol to download repository structures. The problem is that my cooperate proxy wont let me use https on this url. How to force m2e to use http?
我的 eclipse 安装总是使用 https 协议来下载存储库结构。问题是我的合作代理不允许我在这个网址上使用 https。如何强制 m2e 使用 http?
I tried with different external maven installations for m2e but no luck. It only works if i use the external maven from CLI, which uses http.
我为 m2e 尝试了不同的外部 maven 安装,但没有运气。只有当我使用来自 CLI 的外部 Maven 时它才有效,它使用 http。
回答by user1438038
I'd recommend using an external Maven installation anyway, don't rely on the built-in version. In your Maven directory, find the <maven>/conf/settings.xml
file. There you can edit your proxy settings:
无论如何,我建议使用外部 Maven 安装,不要依赖内置版本。在您的 Maven 目录中,找到该<maven>/conf/settings.xml
文件。在那里您可以编辑您的代理设置:
<settings>
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>insecurecentral</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>insecurecentral</id>
<!--Override the repository (and pluginRepository) "central" from the Maven Super POM -->
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
Also, you should update your Maven settings in Eclipse (Maven -> User Settings):
此外,您应该更新 Eclipse 中的 Maven 设置(Maven -> 用户设置):
回答by Marcel
I had a similar problem and I fixed that adding the code below to my pom.xml:
我有一个类似的问题,我修复了将下面的代码添加到我的pom.xml:
<repositories>
<repository>
<id>central-repo</id>
<name>Central Repository</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>