Maven failing to download jar dependencies

92,334

Solution 1

Well for what it's worth, here's the answer to what I've been experiencing.

If I leave Maven at v3.0.1 I have to add the mirror listed above and it works fine.

If I upgrade Maven to v3.0.3 then I have to remove the mirror listed above to make it work. :-)

I tried this on two separate machines and had identical behaviour. This could mean the network here is to blame as they both go through the same router.

Anyway, so there's essentially two workarounds there. I'm not sure if either are the "correct" response, but they keep me moving forward at least.

Thanks to all that submitted answers.

Solution 2

OK guys, I had the same problem downloading a large file. We're all probably using the lightweight HTTP wagon. If you look at the docs:

http://maven.apache.org/wagon/wagon-providers/wagon-http-lightweight/

Known Limitation:

The main limitation is that you can't download data that doesn't fit entirely into memory.

So I increased the memory for Maven:

export MAVEN_OPTS="-Xmx1024m"

and voila, it works. (!!!!)

Solution 3

I had the same problem. In my case AVG antivirus software blocked Maven from downloading artifacts. Disabling it temporarily helped.

Solution 4

I solved this problem by downgrading to Java 6.

Solution 5

In my case, I went to the local repository (~/.m2/repository/), found the corresponding group and discovered that the artifact at which the download is stuck has two files with .part and .part.lock extensions. Deleting them helped.

Share:
92,334
Andre
Author by

Andre

Updated on August 07, 2020

Comments

  • Andre
    Andre almost 4 years

    I have a very simple default application that I've created to test my Eclipse Indigo/Maven v3.0.1 setup on my Windows 7 machine. The Hello World app runs fine from Eclipse.

    Now from the command line I'm trying to test with mvn install.

    At which point I see Maven download a large series of dependencies. For some reason though it will get stuck downloading one and will just stop part way through. It's not at the same point each time, but it's currently consistently the same jar file, eg...

    http://repo1.maven.org/maven2/org/apache/maven/surefire/surefire-booter/2.5/surefire-booter-2.5.jar

    If I download this file from a browser it works perfectly. Quite fast in fact. Now if I manually copy that downloaded file to the appropriate directory in my .m2 repository directory, the install continues to download dependencies until it hits another one at random which it stops at.

    Here's my POM, although I'm not sure it'll help as it's so basic and seems to work fine with a mvn compile.

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
    
      <groupId>com.kyeema</groupId>
      <artifactId>QServer</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>jar</packaging>
    
      <name>QServer</name>
      <url>http://maven.apache.org</url>
    
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>
    
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </project>
    

    Here's some debug output referencing some dummy jar file?

    [INFO] Surefire report directory: C:\workspace\QServer\target\surefire-reports
    [DEBUG] Setting system property [user.dir]=[C:\workspace\QServer]
    [DEBUG] Setting system property [localRepository]=[C:\Users\Andre\.m2\repository]
    [DEBUG] Setting system property [basedir]=[C:\workspace\QServer]
    [DEBUG] Using JVM: C:\Program Files\Java\jdk1.7.0\jre\bin\java
    [DEBUG] dummy:dummy:jar:1.0 (selected for null)
    [DEBUG]   org.apache.maven.surefire:surefire-booter:jar:2.7.2:compile (selected for compile)
    [DEBUG]     org.apache.maven.surefire:surefire-api:jar:2.7.2:compile (selected for compile)
    [DEBUG] Adding to surefire booter test classpath: C:\Users\Andre\.m2\repository\org\apache\maven\surefire\surefire-booter\2.7.2\surefire-booter-2.7.2.jar Scope: compile
    [DEBUG] Adding to surefire booter test classpath: C:\Users\Andre\.m2\repository\org\apache\maven\surefire\surefire-api\2.7.2\surefire-api-2.7.2.jar Scope: compile
    [DEBUG] dummy:dummy:jar:1.0 (selected for null)
    [WARNING] Missing POM for org.apache.maven.surefire:surefire-junit3:jar:2.7.2: Error resolving project artifact: Failure to find org.apache.maven.surefire:surefire-junit3:pom:2.7.2 in http://mirrors.ibiblio.org/pub/mirrors/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of ibiblio.org has elapsed or updates are forced for project org.apache.maven.surefire:surefire-junit3:pom:2.7.2
    [DEBUG]   org.apache.maven.surefire:surefire-junit3:jar:2.7.2:test (selected for test)
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.626s
    [INFO] Finished at: Tue Aug 16 13:18:42 PDT 2011
    [INFO] Final Memory: 8M/154M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.7.2:test (default-test) on project QServer: Error to resolving surefire provider dependency: Missing:
    [ERROR] ----------
    [ERROR] 1) org.apache.maven.surefire:surefire-junit3:jar:2.7.2
    [ERROR] 
    [ERROR] Try downloading the file manually from the project website.
    [ERROR] 
    [ERROR] Then, install it using the command:
    [ERROR] mvn install:install-file -DgroupId=org.apache.maven.surefire -DartifactId=surefire-junit3 -Dversion=2.7.2 -Dpackaging=jar -Dfile=/path/to/file
    [ERROR] 
    [ERROR] Alternatively, if you host your own repository you can deploy the file there:
    [ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.surefire -DartifactId=surefire-junit3 -Dversion=2.7.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
    [ERROR] 
    [ERROR] Path to dependency:
    [ERROR] 1) dummy:dummy:jar:1.0
    [ERROR] 2) org.apache.maven.surefire:surefire-junit3:jar:2.7.2
    [ERROR] 
    [ERROR] ----------
    [ERROR] 1 required artifact is missing.
    [ERROR] 
    [ERROR] for artifact:
    [ERROR] dummy:dummy:jar:1.0
    [ERROR] 
    [ERROR] from the specified remote repositories:
    [ERROR] ibiblio.org (http://mirrors.ibiblio.org/pub/mirrors/maven2, releases=true, snapshots=false)