Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven failing to download jar dependencies

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) 
like image 584
Andre Avatar asked Aug 16 '11 05:08

Andre


People also ask

How do I force Maven to download dependencies in eclipse?

You can right-click on your project then Maven > Update Project..., then select Force Update of Snapshots/Releases checkbox then click OK.

How do I download missing dependencies in Maven?

You can find this in Window > Preferences > Maven > User Settings , and then point Global Settings to your external maven settings. xml . Then i removed the broken projects and re-added them, and the Maven Dependencies library appeared again.


1 Answers

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. (!!!!)

like image 133
Lee Kamentsky Avatar answered Oct 11 '22 03:10

Lee Kamentsky