强制m2e使用http而不是https

强制m2e使用http而不是https

问题描述:

我的Eclipse安装始终使用https协议下载存储库结构.问题是我的合作代理不会允许我在此URL上使用https.如何强制m2e使用http?

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?

我尝试使用不同的外部Maven安装进行m2e,但没有运气. 仅当我使用CLI使用http的外部Maven时,它才有效.

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.

我还是建议您使用外部Maven安装,不要依赖内置版本.在您的Maven目录中,找到<maven>/conf/settings.xml文件.在这里,您可以编辑代理设置:

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:

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

此外,您还应该在Eclipse中更新Maven设置(Maven->用户设置):

Also, you should update your Maven settings in Eclipse (Maven -> User Settings):