问题:pom文件飘红, parent.relativePath

一、问题描述

parent.relativePath’ of POM com.dabing.resume:dabing-cloud-gateway-9002:1.0-SNAPSHOT (G:\gitee_local_ws_lg\springcloud_ws2\dabing-resume-parent\dabing-cloud-gateway-9002\pom.xml) points at com.dabing.resume:dabing-resume-parent instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure

在这里插入图片描述

二、原因

错误信息:

G:\gitee_local_ws_lg\springcloud_ws2\dabing-resume-parent\dabing-cloud-gateway-9002\pom.xml) points at com.dabing.resume:dabing-resume-parent instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure

其中dabing-resume-parent不是当前项目dabing-cloud-gateway-9002的父工程,此处应该使用spring-boot-starter-parent进行替换

三、解决

relativePath:

  1. 指定查找该父项目pom.xml的(相对)路径。默认顺序:relativePath > 本地仓库 > 远程仓库
  2. 没有relativePath标签默认从当前pom文件的上一级目录找
  3. 配置relativePath并且设置成一个空值,将始终从仓库中获取,不从本地路径获取
    <!--spring boot 父启动器依赖-->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.6.RELEASE</version>
        <!--添加此依赖,-->
        <relativePath />
    </parent>

四、验证

在这里插入图片描述


版权声明:本文为chuanchengdabing原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。