Java 项目构建错误:不可解析的父 POM。无法传输 org.springframework.boot:spring-boot-starter-parent

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50364469/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 23:35:15  来源:igfitidea点击:

Project build error: Non-resolvable parent POM. Failure to transfer org.springframework.boot:spring-boot-starter-parent

javaspringmavenspring-boot

提问by Faizan Mubasher

Here is my pom.xml

这是我的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.skm</groupId>
    <artifactId>MyApps</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <parent> <!-- Problem -->
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.2.RELEASE</version>
        <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
    </parent>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

This line <parent>is causing problem.

这条线<parent>引起了问题。

Project build error: Non-resolvable parent POM for com.skm:MyApps:0.0.1-SNAPSHOT: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.2.RELEASE from https://repo.maven.apache.org/maven2was 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.springframework.boot:spring-boot-starter-parent:pom:2.0.2.RELEASE from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org and 'parent.relativePath' points at wrong local POM

项目构建错误:com.skm 的不可解析父 POM:MyApps:0.0.1-SNAPSHOT: 无法从https:/传输 org.springframework.boot:spring-boot-starter-parent:pom:2.0.2.RELEASE /repo.maven.apache.org/maven2已缓存在本地存储库中,直到central 的更新间隔已过或强制更新时才会重新尝试解析。原始错误:无法传输工件 org.springframework.boot:spring-boot-starter-parent:pom:2.0.2.RELEASE from/to central ( https://repo.maven.apache.org/maven2):repo。 maven.apache.org 和 'parent.relativePath' 指向错误的本地 POM

I have seen these links but unable to resolve it.

我看过这些链接,但无法解决。

Maven: Non-resolvable parent POMMaven: Non-resolvable parent POM

Maven:不可解析的父 POM Maven:不可解析的父 POM

采纳答案by Raja Anbazhagan

You are pointing to a Parent pom that does not exist in your local repository. You should remove value for <relativePath>tag so that maven could fetch the pom file from maven central repository.

您指向的 Parent pom 在您的local repository. 您应该删除<relativePath>tag 的值,以便 maven 可以从 maven 获取 pom 文件central repository

Change your parent tag as shown below.

更改您的父标签,如下所示。

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.2.RELEASE</version>
    <relativePath />
</parent>