当我尝试运行我的应用程序时,我在pom.xml中遇到以下异常。我看到一些关于错误的帖子,并关注它们,但没有使用。我知道工件(父级)是本地引用的,不存在,但我不知道如何解决这个问题,有人能帮助我吗?
错误是
Project build error: Non-resolvable parent POM for com.example:demo:0.0.1-SNAPSHOT: Failure
to transfer org.springframework.boot:spring-boot-starter-parent:pom:1.5.18.BUILD-SNAPSHOT
from https://repo.spring.io/snapshot was cached in the local repository, resolution will not be
reattempted until the update interval of spring-snapshots has elapsed or updates are forced.
Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-
parent:pom:1.5.18.BUILD-SNAPSHOT from/to spring-snapshots (https://repo.spring.io/
snapshot): repo.spring.io and 'parent.relativePath' points at no local POM
下面是pom.xml
<?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>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.18.BUILD-SNAPSHOT</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-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
4条答案
按热度按时间hlswsv351#
1.将Spring罩起动机降级为较低版本。
1.更新Maven项目。
希望能成功。
ibps3vxo2#
您正在使用的Sping Boot 版本有问题,因为它是一个内部版本。只需复制另一个1.X发布版本并替换它。
fnvucqvd3#
如果可以从浏览器访问url https://repo.spring.io/snapshot/,则可能是Maven问题。Maven无法连接到存储库,原因可能是:
1.下载的依赖项中存在任何缓存问题。请尝试删除本地依赖项,并试用here提供的解决方案。
1.尝试Maven更新和Maven清理。
1.执行上述操作后,尝试重新打开IDE。
k2arahey4#
您的pom.xml文件没有问题,但看起来您的Internet连接有问题。请检查您的浏览器是否可以访问https://repo.spring.io/snapshot/。如果可以,请检查您是否需要配置代理服务器。如果不需要,请与您的Internet提供商联系。
以下是有关如何为Maven配置代理服务器的documentation: