Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.22.2 from https://repo.maven.apache.org/maven2

I've just create a new spring boot project and I have a problem in the pom.xml and I have no idea how to resolve it, please someone help.

this is my pom.xml i got an error in first line. "Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.22.2 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.22.2 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled."

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.1.5.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.amol.student.dal</groupId>
	<artifactId>studentdal</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>studentdal</name>
	<description>Student DAL</description>

	<properties>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
		</dependency>

		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

</project>
like image 330
Amol Biradar Avatar asked Feb 17 '26 19:02

Amol Biradar


2 Answers

Delete folder maven-surefire-plugin from location ~/.m2/repository/org/apache/maven/plugins. And rigth click on project -> Maven-> update project.

like image 145
Rhushikesh Chaudhari Avatar answered Feb 19 '26 09:02

Rhushikesh Chaudhari


Go on the top, menu bar, then click on Run > Run As > Maven Install and let the process be complete, after that, Now right click on pom.xml file > maven > update project.

After struggling for 1.5 hours, These steps worked for me.

like image 41
Akash Sahu Avatar answered Feb 19 '26 09:02

Akash Sahu