When you add a dependency in your Java Maven projects pom.xml file and try to refresh your project to download the new dependency you may see errors like,
Could not find artifact junit:junit:pom:5.2.1 in central (https://repo.maven.apache.org/maven2)
Reason for the error
- Invalid or incorrect dependency details.
- Incorrect artifact version number.
- Network connectivity issues.
- A Temporary Outage reaching the repository.
- Proxy server issues
Example with a fix
Let's say I am trying to add a dependency for Junit with version 5.2.1
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>5.2.1</version>
<scope>test</scope>
</dependency>
I get an error here because the version 5.2.1 for junit does not exists at the remote repository: https://repo.maven.apache.org/maven2/junit/junit/
[WARNING] The POM for junit:junit:jar:5.2.1 is missing, no dependency information available
Cannot resolve junit:junit:5.2.1
Unresolved dependency: 'junit:junit:jar:5.2.1'
When I change the dependency version to 4.9 it worked.
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<scope>test</scope>
</dependency>
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!