paulwong

Maven project version inheritance

A/pom.xml:
<groupId>com.dummy.bla</groupId>
<artifactId>parent</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>

B/pom.xml
<parent>
    <groupId>com.dummy.bla</groupId>
    <artifactId>parent</artifactId>
    <version>0.1-SNAPSHOT</version>     
</parent>

<groupId>com.dummy.bla.sub</groupId>
<artifactId>kid</artifactId>

B/pom.xml中需要显式注明父pom的版本号,但从MAVEN3.5之后,可以用变量表示了:

A/pom.xml:
<groupId>com.dummy.bla</groupId>
<artifactId>parent</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>

<properties>
    <revision>0.1-SNAPSHOT</revision>
</properties>

B/pom.xml
<parent>
    <groupId>com.dummy.bla</groupId>
    <artifactId>parent</artifactId>
    <version>${revision}</version>     
</parent>

<groupId>com.dummy.bla.sub</groupId>
<artifactId>kid</artifactId>

https://stackoverflow.com/questions/10582054/maven-project-version-inheritance-do-i-have-to-specify-the-parent-version/51969067#51969067


https://maven.apache.org/maven-ci-friendly.html

posted on 2020-12-16 09:48 paulwong 阅读(300) 评论(0)  编辑  收藏 所属分类: MAVEN


只有注册用户登录后才能发表评论。


网站导航: