使用git commit hash和maven-release-plugin

时间:2018-06-18 06:44:47

标签: git maven maven-release-plugin

我尝试将应用的发布版本号设置为1.5.0.057b2009,其中包含缩写的git commit hash。

设置

我尝试将maven-release-plugingit-commit-id-plugin结合使用。

我们在开发中的基本版本号是1.5.0-SNAPSHOT。

<plugin>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.5.1</version>
    <configuration>
        <tagNameFormat>APP-NAME-@{version}</tagNameFormat>
        <autoVersionSubmodules>true</autoVersionSubmodules>
        <preparationGoals>clean install</preparationGoals>
        <localCheckout>true</localCheckout>
        <pushChanges>true</pushChanges>
        <branchName>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.x</branchName>
        <releaseVersion>${project.version}.${git.commit.id.abbrev}</releaseVersion>
    </configuration>
</plugin>
<plugin>
    <groupId>pl.project13.maven</groupId>
    <artifactId>git-commit-id-plugin</artifactId>
    <version>2.1.7</version>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>revision</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
        <generateGitPropertiesFile>false</generateGitPropertiesFile><!-- somehow necessary. otherwise the variables are not available in the pom -->
    </configuration>
</plugin>

构建

整个项目使用以下命令构建:

mvn -B release:prepare

问题

maven发布插件完全忽略了releaseVersion属性。实际发布版本为1.5.0,我该如何处理?

0 个答案:

没有答案