“Could not resolve dependencies” error keep coming. Why ?

2.6K    Asked by KalyaniMalhotra in Devops , Asked on Feb 17, 2020
Answered by Ankur vaish

This is a worrying error as it’s not difficult to resolve but to debug. Some of the steps to follow for resolution of this error:

The dependency is defined correctly

Remote repository URL is correct which is storing the dependency.

Remote repository actually contains the dependency or not.

Recent pom.xml files for each module/sub-module.

Jar corrupted or not.

If the company repository is caching the internet repositories and not issuing latest versions.

Dependency definition is being overridden by something. mvn help:effective-pom can help in this.

Don’t use -o

/e.g. , Suppose POM has dependency as following:

       

            com.janBask.password

            password

            1.0

       

When we compile our code, it failed because of an “Unresolved Dependencies” error. This is the jar, which should be present in central/remote repository, but it is not so getting error:

[ERROR] Failed to execute goal on project web: Could not resolve dependencies for project com.janBask:web:war:1.0: Could not find artifact com.janBask.password:password:jar:1.0 in central (https://repo.maven.apache.org/maven2) -> [Help 1]



Your Answer

Interviews

Parent Categories