calaedo
calaedo

Reputation: 333

Force m2e to use http instead of https

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?

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.

Upvotes: 9

Views: 36732

Answers (2)

user1438038
user1438038

Reputation: 6079

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>

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

Maven User Settings

Upvotes: 15

Marcel
Marcel

Reputation: 3288

I had a similar problem and I fixed that adding the code below to my pom.xml:

<repositories>
    <repository>
        <id>central-repo</id>
        <name>Central Repository</name>
        <url>http://repo1.maven.org/maven2</url>
    </repository>
</repositories>

Upvotes: 8

Related Questions