May12
May12

Reputation: 2520

Artifact downloading takes a lot of time without result

Please, help me with the following situation:

  1. I have two Nexus repositories

  2. I have two settings.xml files in C:\Users\Login.m2:

    releases developer snapshots developer

    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <id>releases</id>
                    <name>Releases Repository</name>
                    <url>http://30.30.20.40:8085/nexus/content/repositories/releases/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>snapshots</id>
                    <name>Snapshots Repository</name>
                    <url>http://30.30.20.40:8085/nexus/content/repositories/snapshots/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>thirdparty</id>
                    <name>3-d Party Artifacts Repository</name>
                    <url>http://30.30.20.40:8085/nexus/content/repositories/thirdparty/</url>
                               <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>
    

and in C:\apache-maven-3.2.3\conf:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <servers>
   <server>
      <id>snapshots</id>
      <username>deployment</username>
      <password>@@@@@@@@</password>
   </server>
   
   <server>
            <id>releases</id>
            <username>developer</username>
            <password>@@@@@@</password>
   </server>
  <server>
            <id>snapshots</id>
            <username>developer</username>
            <password>@@@@@@</password>
    </server>
   
    <server>
            <id>thirdparty</id>
            <username>developer</username>
            <password>@@@@@@@@@@</password>
    </server>
 </servers>

    
  
  <profiles>
    
  <profile>
    <id>nexus</id>
    <repositories>
             <repository>
                <id>nexus-repo</id>
                <name>Nexus repo</name>
                <url>http://192.22.0.17:8080/nexus-webapp-2.11.0-02/content/groups/public/</url>
                <releases>
                  <enabled>true</enabled>
                </releases>
                <snapshots>
                  <enabled>true</enabled>
                </snapshots>
             </repository>
      
    </repositories>

</profile>
   
  <profile>
    <id>adc</id>
    <repositories>
           <repository>
                    <id>releases</id>
                    <name> Releases Repository</name>
                    <url>http://30.30.20.40:8085/nexus/content/repositories/releases/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
           </repository>
        
        <repository>
                    <id>snapshots</id>
                    <name>Snapshots Repository</name>
                    <url>http://30.30.20.40:8085/nexus/content/repositories/snapshots/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
    
          <repository>
            <id> thirdparty</id>
            <name>3-d Party Artifacts Repository</name>
                <url>http://30.30.20.40:8085/nexus/content/repositories/thirdparty/</url>
                    <releases>
                <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
           </repository>
      
      
    </repositories>
    
    <pluginRepositories>
      <pluginRepository>
        <id>nexus-repo</id>
        <name>Nexus repo </name>
        <url>http://192.22.0.17:8080/nexus-webapp-2.11.0-02/content/groups/public/</url>
        <releases>
          <enabled>true</enabled>
        </releases>
        <snapshots>
          <enabled>true</enabled>
        </snapshots>
      </pluginRepository>
      
  <pluginRepository>
        <id>releases</id>
        <name> Releases Repository</name>
        <url>http://30.30.20.40:8085/nexus/content/repositories/releases/</url>
      <releases>
        <enabled>true</enabled>
    </releases>
        <snapshots>
            <enabled>false</enabled>
    </snapshots>
      </pluginRepository>
      
      
    </pluginRepositories>
</profile>
  </profiles>
<activeProfiles>
  <activeProfile>nexus</activeProfile>
  <activeProfile>adc</activeProfile>
</activeProfiles>
</settings>
  1. The problem is: when I run "mvn clean package" downloading takes a lot of time:

[INFO] Downloading: http://30.30.20.40:8085/nexus/content/repositories/releases/org/apache/httpcomponents/project/4.1.1/project-4.1.1.pom [INFO] Downloading: http://30.30.20.40:8085/nexus/content/repositories/thirdparty/org/apache/httpcomponents/project/4.1.1/project-4.1.1.pom

It looks like Maven try to download artifact in one repository and when fail try to download artifact in another repository.

I'am trying to correct C:\Program Files\Java\jdk1.7.0_67\jre\lib\amd64\jvm.cfg as described here https://rogerkeays.com/why-is-maven-so-slow but no effect.

This is my additional settings:

java -version

java version "1.8.0_40" Java(TM) SE Runtime Environment (build 1.8.0_40-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

mvn -version Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-12T00:58:10+04:00) Maven home: C:\apache-maven-3.2.3\bin.. Java version: 1.7.0_67, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.7.0_67\jre Default locale: ru_RU, platform encoding: Cp1251 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

Upvotes: 3

Views: 1819

Answers (3)

pratap
pratap

Reputation: 628

You can use -T command to run the maven in multiple threads, something like below,

mvn clean install -T 4

This will execute the maven build in 4 threads. You can try mvn --help for more information on this.

Upvotes: 1

Ken
Ken

Reputation: 1260

Repocache speedup download. It's remarkable.

Add repocache.cfg

[mvn.upstream.releases]
url = http://30.30.20.40:8085/nexus/content/repositories/releases

This will cache package at mvn/releases.

Change $HOME/.m2/settings.xml add:

<repository>
  <id>releases</id>
  <url>http://127.0.0.1:5000/mvn/releases</url>
</repository>

This worked for me.

Upvotes: 0

May12
May12

Reputation: 2520

I my case, described below, the problem was in security settings. Security officer disabled (set up) security agent on my pc and now artifacts are downloading fine. Thank you, Gimby.

Upvotes: 0

Related Questions