【问题标题】:Relative Path in Maven parent definitionMaven父定义中的相对路径
【发布时间】:2016-02-24 17:27:02
【问题描述】:

在定义父工件时,我是否需要在孩子的 pom 中包含 ?例如,

<relativePath> 是可选的还是必需的?

<parent>
    <groupId>org.hibernate.tutorials</groupId>
    <artifactId>hibernate-tutorials</artifactId>
    <version>5.1.0.Final</version>
    <relativePath>../pom.xml</relativePath>
</parent>

【问题讨论】:

    标签: maven


    【解决方案1】:

    这不是必需的。来自the docs

    relativePath: 父pom.xml 文件在检出中的相对路径。如果未指定,则默认为../pom.xml。 [...]

    这意味着你可以省略这个元素,它将默认为你已经拥有的,即 Maven 将在 ../pom.xml 中查找父 POM,这是一个目录。

    【讨论】:

      【解决方案2】:

      根据 maven doc

      Notice the relativePath element. It is not required, but may be used as a signifier to Maven to first search the path given for this project's parent, before searching the local and then remote repositories.
      

      【讨论】:

        猜你喜欢
        • 2016-08-31
        • 1970-01-01
        • 1970-01-01
        • 2021-10-24
        • 1970-01-01
        • 1970-01-01
        • 2016-06-20
        • 2012-12-21
        相关资源
        最近更新 更多