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>
-
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to Java,
- Java equals method - Tutorial
- Unbound classpath container: JRE System Library [JavaSE-1.7]
- Spring Boot: @RequestBody not applicable to method
- Java 8: Steam map with Code Examples
- Java Program: Random Number Generator
- Java java.time.Clock class code examples [Java Date Time API]
- Fix: type argument is not within bounds of type-variable T
- [Fix] java.net.MalformedURLException: unknown protocol
- Java 7 addSuppression() and getSuppression() Exception Handling
- Convert Java Array to ArrayList Code Example
- How to Word-Warp Console logs in IntelliJ
- Ways Compare Dates in Java Programming with Examples
- Remove Trailing zeros BigDecimal Java
- CRUD operations in Spring Boot + JDBC
- [Java Threads] Should we extend Thread Class or implement Runnable interface
- Json Serialization and Deserialization using Java Jackson
- Create simple struts2 project using maven commands
- How to install Java OpenJDK 11 on Alpine Linux
- Unsupported major.minor version 52.0 in java
- Error: Can not find the tag library descriptor for
- Java: Convert String to Binary
- How to run Java Unit Test cases with Apache Maven?
- Java: Testing Private Methods in JUnit using reflection API Example
- Java JDBC Connection with MySQL Driver in VS Code + Troubleshooting
- Java Join Strings with Comma Separator
More Posts:
- Error code 0xCAA82EE2: Something went wrong (request timed out) [Microsoft] - Microsoft
- 10 ways to Convert String to a Number in JavaScript - JavaScript
- How to install Google Chrome using Mac Terminal - Google
- Install Docker Desktop on M1/M2 Apple Silicon ARM Chip Mac - Docker
- Implementing Merge Sort Algorithm in Java Program - Java
- Capture cURL Request Output to a File - cURL
- How to change the default location of Mac Screenshot - MacOS
- Fix: Error: Could not find or load main class org.gradle.wrapper. GradleWrapperMain - Gradle