我刚刚创建了一个新的 spring boot 项目,我在 pom.xml 中遇到了问题,我不知道如何解决它,请有人帮忙。
这是我的 pom.xml 我在第一行遇到错误。 “无法从 https://repo.maven.apache.org/maven2 传输 org.apache.maven.plugins:maven-surefire-plugin:pom:2.22.2| 已缓存在本地存储库中,直到中央更新间隔结束或 强制更新。原始错误:Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.22.2 从/到中心(https://repo.maven.apache.org/maven2):操作已取消。”
<?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>
最佳答案
从位置 ~/.m2/repository/org/apache/maven/plugins 删除文件夹 maven-surefire-plugin。然后右键单击项目 -> Maven-> 更新项目。
关于java - 无法从 https :maven-surefire-plugin:pom:2. maven.apache.org/maven2 传输 org.apache.maven.plugins ://repo. 22.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56345168/