Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ports and protocol used by Maven to download dependencies in Eclipse?

I'm on an enterprise working with eclipse as a programmer, and I have a project that works perfect at home. However, when I try to compile the pom.xml at work it says: "Failure to transfer org.apache.maven" and "connect time out". I think it is because the network firewall in the enterprise is very restrictive with the use of ports, possibly blocking the acces. Does anyone know which ports and protocol does maven use to configure itself and do the installation? Can those ports be manually changed?

Thank you very much!

like image 821
Amnor Avatar asked Mar 06 '17 13:03

Amnor


People also ask

How do I download Maven dependencies in Eclipse?

Via the Maven index, you can search for dependencies, select them and add them to your pom file. To download the index, select Windows > Preferences > Maven and enable the Download repository index updates on startup option. After changing this setting, restart Eclipse. This triggers the download of the Maven index.

What ports does Maven use?

The proxy port. Default value is: 8080 . The proxy host.

What protocol does Maven use?

By default, Maven uses the java. net. URLConnection ( HttpURLConnection ) classes provided with the JDK to access repositories that use the HTTP/HTTPs protocols.

What is the Maven command to download dependencies?

Summary. You can use the Maven Dependency Plugin to download dependencies. Run mvn dependency:copy-dependencies , to download all your dependencies and save them in the target/dependency folder. You can change the target location by setting the property outputDirectory .


2 Answers

To modify the url port you can do something like this in settings.xml:

 <repositories>
      <repository>
          <id>repoId</id>
          <url>http://url:port/remains</url>
          <releases>
            <enabled>true</enabled>
          </releases>
        </repository>
</repositories>

And to use a proxy in maven, you can also add modify your 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>
  .
  .
</settings>

Adapt as needed.

like image 135
Adonis Avatar answered Sep 21 '22 17:09

Adonis


..\apache-maven-*.*.*\conf\settings.xml

mirrors add

   <mirror>
        <id>nexus-aliyun</id>
        <mirrorOf>*</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
like image 24
itsccn Avatar answered Sep 18 '22 17:09

itsccn