maven的pom文件<relativePath/>作用

maven项目,父子模块,父工程pom中的relativePath。

这个<parent>下面的<relativePath>属性:parent的pom文件的路径

<parent>
    <groupId>***</groupId>
    <artifactId>***</artifactId>
    <version>***</version>
    <relativePath/>
</parent>
  1. 默认值:

默认我们不用写<relativePath>,那默认值就是 ../pom.xml,会从本地路径中获取parent的pom

<parent>
    <groupId>***</groupId>
    <artifactId>***</artifactId>
    <version>***</version>

</parent>
  1. <relativePath/>:

设定一个空值将始终从仓库中获取,不从本地路径获取.

<parent>
    <groupId>***</groupId>
    <artifactId>***</artifactId>
    <version>***</version>
    <relativePath/>
</parent>
  1. <relativePath>某个pom的路径<relativePath/>:

指定本地的路径,从本地路径获取parent的pom。

<parent>
    <groupId>***</groupId>
    <artifactId>***</artifactId>
    <version>***</version>
        <relativePath>***<relativePath/>
</parent>
maven项目,父子模块,父工程pom中的relativePath。 这个 下面的 属性:parent的pom文件的路径 *** *** *** 默认值: 默认我们不用写 ,那默认值就是 ../pom.xml,会从本地路径中获取parent的pom *** *** *** : 设定一个空值将始终从仓库中获取,不从本地路径获取. *** *** *** 某个pom的路径 : 指定本地的路径,从本地路径获取parent的pom。 *** *** *** ***
经验分享 程序员 微信小程序 职场和发展