Maven Could Not Resolve Dependency Via Local Nexus Repository

11.8k views Asked by At

Why is Maven unable to resolve dependency with maven central when configured with our local Nexus Repository?

I setup an in-house Sonatype Nexus repository and configure the maven to check my local Nexus instead of getting artifacts directly from public repositories. Our project was able to download the most artifacts except one artifact in Maven central. Here is the build error:

Failed to execute goal on project shindig-gadgets: 
Could not resolve dependencies for project org.apache.shindig:shindig-gadgets:jar:3.0.0-SNAPSHOT: Could not find artifact com.ibm.icu:icu4j:jar:4.6 
in nexus (http://my_nexus_repository:8081/nexus/content/groups/public) -> [Help 1]

I see that icu4j-4.6.jar does exist in the Maven central repository. On my local nexus repository, this jar doesn't exist.
I see only icu4j-4.6.pom exists on my local nexus repository.
Maven project has successfully downloaded numerous jar files from multiple public repositories via my local nexus maven repository except icu4j-4.6.jar.

The similar problem is described at Missing maven dependency using nexus setup icu4j-4.6.jar does not show up in the search list. Only icu4j-4.6.pom shows up in the search list. I don't think is Snapshot VS Release issue because icu4j-4.6.jar seems release jar.

I don't understand why I'm having a problem with only icu4j-4.6.jar.
Would it be incorrectly cached on either my local maven or nexus maven repository?
If it was incorrectly cached, how can I clean the local maven or nexus maven repository?

4

There are 4 answers

0
Mike Sokolov On

Is it possible that the nexus repo just stopped responding for a while? You can try mvn -X (or -d?) to get detailed info about what is going on. You might also try configuring an alternative repo.

1
Mark O'Connor On

Perhaps you haven't enabled remote index downloads from Maven Central. This would explain why only the POM file appears in your local search (The only file which has been downloaded via the proxy repo).

There might be another issue causing the download failure for the jar itself.... I suppose try and solve one problem at a time :-)

0
KRK Owner On

Try adding -U to your mvn arguments to force an update of your local repository.

You could also have corrupt meta data in the repo. In which case, delete that artifact from the repo's cache and let it refresh.

0
Adnan Khan On

If the artifact in question was cached in properly from the proxy repository, using mvn -U will fix the problem

However if you are seeing pom on your nexus ,this usually happens when the artifact from the proxy repository is not cached in properly. The way to fix is

1) Browse to the component in the Proxy Repository.

2) Invalidate the cache for the repository and reindex the Nexus repository.

3) run mvn clean -U