Error in maven while downloading dependencies
Solution 1
This shouldn't be working with maven2 either.
From the error message, it looks like maven is trying to download dependencies from the repository specified in your pom - oracleReleases (http://download.oracle.com/maven) and not the public maven repo. This appears to be an invalid repository url.
Perhaps you should try removing the section and retry.
Solution 2
This is covered by another stackoverflow question which boils down to the Oracle repo not allowing directory listings.
Solution 3
I had the dependencies versions externalized as properties. Like:
<properties>
[...]
<hibernate-core.version>4.1.3.Final</hibernate-core.version>
[...]
</properties>
And:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate-core.version}</version>
</dependency>
I closed the project, changed the version declaration to be explicit as
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.3.Final</version>
</dependency>
it worked!
Related videos on Youtube
zengr
Software Engineer in San Fransisco Bay Area. #Java #Python #Generalist ↑ ↑ ↓ ↓ ← → ← → B A
Updated on June 04, 2022Comments
-
zengr almost 2 years
My project1 and project2 were working fine with maven builds. Recently I upgraded from maven2 to maven3 using this tutorial (I checked it on maven2,but it didn't work either). Everything worked and is working fine for project2 which has a private (self hosted) Nexus repo.
But, now I am getting error while downloading dependencies for my project1 (using public maven repo).
My pom.xml:
<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.dds.server.DDSStartup</groupId> <artifactId>storage</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>storage</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> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>r07</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16</version> </dependency> <dependency> <groupId>com.sleepycat</groupId> <artifactId>je</artifactId> <version>3.3.75</version> </dependency> <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>jgroups</groupId> <artifactId>jgroups-all</artifactId> <version>2.4.1</version> </dependency> </dependencies> <repositories> <repository> <id>oracleReleases</id> <name>Oracle Released Java Packages</name> <url>http://download.oracle.com/maven</url> <layout>default</layout> </repository> </repositories> </project>
Where am I going wrong, this is the error I get when I do a :
mvn clean package
[ERROR] Failed to execute goal on project storage: Could not resolve dependencies for project com.dds.server.DDSStartup:DynamicDistributedStorage:jar:1.0-SNAPSHOT: Failed to collect dependencies for [junit:junit:jar:3.8.1 (test), com.google.guava:guava:jar:r07 (compile), log4j:log4j:jar:1.2.16 (compile), com.sleepycat:je:jar:3.3.75 (compile), com.google.protobuf:protobuf-java:jar:2.3.0 (compile), jgroups:jgroups-all:jar:2.4.1 (compile)]: Failed to read artifact descriptor for log4j:log4j:jar:1.2.6: Could not transfer artifact log4j:log4j:pom:1.2.6 from/to oracleReleases (http://download.oracle.com/maven): /Users/username/.m2/repository/log4j/log4j/1.2.6/log4j-1.2.6.pom.ahc65d8d087349b4a46 (No such file or directory) -> [Help 1]
UPDATE:
I deleted everything (workspace), imported the project again and it worked like a charm. Nothing can beat that solution! ;)
-
Admin over 13 yearsSorry, if I delete this question I'm doing a disservice to the people who took the time to help you. Please select an answer that helped you the most or answer it yourself so that people with the same issue will find the solution.
-
-
mglauche over 13 yearsorcacleReleases is needed for the sleepycat dependency, the repository part looks correct.
-
Jan Groth almost 13 yearssorry mate, seems like I accidentally downvoted your answer. That was rather too much clicking around then my intention, but I can't revoke it 10 minutes after... :-(
-
jvdbogae almost 10 yearsCan this be upvoted? I had the same problem (after putting the version number in a property). Before I did not have the problem. The BerkeleyDb repo seems to be correct as listed in oracle.com/technetwork/database/database-technologies/…