我刚刚创建了一个新的spring boot projet,我在pom.xml中遇到了问题,我不知道如何解决它,请一些帮助,谢谢大家 .
它在父标记whitch中的pom.xml中的错误是:
项目构建错误:com.example的不可解析的父POM:ProjetTest:0.0.1-SNAPSHOT:无法传输org.springframework.boot:来自https://repo.maven.apache.org/maven2的spring-boot-starter-parent:pom:2.0.0.RELEASE被缓存在本地存储库中,在中心的更新间隔过去或强制更新之前,不会重新尝试解析 . 原始错误:无法传输工件org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.RELEASE from / to central(https://repo.maven.apache.org/ maven2):连接被拒绝:连接和'parent.relativePath'指向无本地POM
<?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>
<groupId>com.example</groupId>
<artifactId>TicketingCGI</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>TicketingCGI</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</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>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
2 回答
要尝试的事情
<project>
标签,如下所示: -<relativePath/>
,父母将如下所示: -如果仍然没有解决那么它可能是各种各样的事情,如: -
互联网连接,也可能是代理问题
尝试删除文件夹
M2_FOLDER_LOCATION\.m2\repository\org\springframework\boot\spring-boot-parent
,然后重新导入项目 .relativePath
需要一个内部路径,如下所示:您可能需要做的就是删除
<relativePath/>
并让您的父母看起来像这样: