参考文档

    1. <parent>
    2. <groupId>org.springframework.boot</groupId>
    3. <artifactId>spring-boot-starter-parent</artifactId>
    4. <version>2.2.1.RELEASE</version> <!-- 基于springboot-2.2.1版本开发 -->
    5. <relativePath/>
    6. </parent>
    1. 官方文档

      1. The relative path of the parent pom.xml file within the check out.
      2. The default value is ../pom.xml.
      3. Maven looks for the parent pom first in the reactor of currently building projects, then in this location on
      4. the filesystem, then the local repository, and lastly in the remote repo.
      5. relativePath allows you to select a different location,
      6. for example when your structure is flat, or deeper without an intermediate parent pom.
      7. However, the group ID, artifact ID and version are still required,
      8. and must match the file in the location given or it will revert to the repository for the POM.
      9. This feature is only for enhancing the development in a local checkout of that project.
    2. 解释:

      • 作用:指明继承父项目的pom.xml文件位置
      • 默认值:../pom.xml
      • 寻找顺序:找不到则转下一步,都找不到则保错
        1. Maven looks for the parent pom first in the reactor of currently building projects

    即:首先在当前构建项目的反应堆中查询,有关反应堆(reactor )的概念可以参考maven reactor
    简单说下reactor的作用:

    1. - 应堆是多模块(聚合)构建的基础:它计算模块之间的依存关系有向图,从该图得出构建顺序,但对Maven用户变得透明。
    2. - 收集模块详细信息
    3. - 根据依赖关系对顺序排序
    4. - 按顺序构建项目
    5. 2. 然后在文件系统中寻找:
    6. 1. 没有写<relativePath/>,默认../pom.xml查询
    7. 1. 如果只写<relativePath/>但没有指定路径,默认../pom.xml查询
    8. 1. 否则,去文件系统指定位置查找
    9. 3. 去本地仓库寻找
    10. 3. 去远程仓库寻找