我从spring初始化程序中下载了一个spring项目,并通过maven将其导入了sts。
不幸的是,构建不断失败,并出现以下错误:
项目构建错误:不可解析的父POM com.dellteam:firstmicroservice:0.0.1-SNAPSHOT:无法传输
神器 org.springframework.boot:spring-boot-starter-parent:pom:2.1.0.RELEASE 从/到春季里程碑(https:// repo.spring.io/milestone): 连接重置和“ parent.relativePath”指向没有本地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.dellteam</groupId>
<artifactId>firstmicroservice</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>firstmicroservice</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.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>
<spring-cloud.version>Greenwich.M1</spring-cloud.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-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
我认为我的ISP不允许我访问https://repo.spring.io/milestone/
,但事实并非如此。
我完全可以访问该网址。
我现在尝试清理和构建几次,并删除了 .m2文件夹,然后再次尝试重建项目,但是结果是相同的。
任何帮助将不胜感激。
答案 0 :(得分:1)
它与您的互联网连接有关。检查是否需要配置代理服务器。您可以在.m2目录下的settings.xml中设置代理,检查This link以配置代理。
答案 1 :(得分:0)
将Spring Plugin Release Repo添加到Plugin-Repositories。这样就可以找到spring-boot-maven-plugin-2.1.0.RELEASE。 将以下行添加到标签下,如下所示:
<project>
<!------ others lines -->
<pluginRepositories>
<pluginRepository>
<id>repository.spring.release</id>
<name>Spring GA Repository</name>
<url>https://repo.spring.io/plugins-release/</url>
</pluginRepository>
</pluginRepositories>
</project>
有关更多信息,请检查-> Spring boot starter parent 2.0.0 not found dependency