本文介绍了项目生成错误:不可解析的父POM.无法传输org.springframework.boot:spring-boot-starter-parent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的 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>

此行<parent>引起了问题.

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

I have seen these links but unable to resolve it.

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

推荐答案

您所指的是local repository中不存在的Parent pom.您应该删除<relativePath>标记的值,以便maven可以从maven central repository获取pom文件.

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.

如下所示更改您的父标签.

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>

这篇关于项目生成错误:不可解析的父POM.无法传输org.springframework.boot:spring-boot-starter-parent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 22:18