user19937
user19937

Reputation: 587

why this maven error all of a sudden

I took a new laptop and setting my environment. the code that builds fine on a different machine is failing with the following error:

Failed to collect dependencies at javax.enterprise:cdi-api:jar:2.0: Failed to read artifact descriptor for javax.enterprise:cdi-api:jar:2.0: Could not transfer artifact javax.enterprise:cdi-api:pom:2.0 from/to maven2-repository.dev.java.net (http://download.java.net/maven/2/): download.java.net: Unknown host download.java.net -> [Help 1]

this is happening intermittently. What is wrong ? any solution please ?

Upvotes: 1

Views: 450

Answers (2)

Jigar Joshi
Jigar Joshi

Reputation: 240946

Maven repository is resolving to 404 (for me too currently). It is oracle's problem. I suggest you can use multiple repositories including central nexus to avoid having single point of failure.

Ideally your organization should have one proxy repository which acts as your org level cache for public artifacts and could also act as internal repository for private artifacts.

Add these to your pom.xml and retry

<repositories>
    <repository>
      <id>central</id>
      <url>https://repo.maven.apache.org/maven2/</url>
    </repository>
 </repositories>

Upvotes: 3

SamwellTarly
SamwellTarly

Reputation: 832

This error happened to me when I was behind a corporate firewall. You could try setting up a proxy server in maven settings in .m2 folder.

Also see If you can download the file directly from the maven repository website at that moment. Mostly you cannot download due to some network issue you are facing.

Maven settings will not change intermittently.

Upvotes: 0

Related Questions