在buildnumber-maven-plugin中切换git提供程序

问题描述 投票:3回答:1

使用buildnumber-maven-plugin时,如果在命令行上构建期间%PATH%中没有git可执行文件,则执行失败:

[ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (default) on project test: Cannot get the revision information from the scm repository :
[ERROR] Exception while executing SCM command. Error while executing command. Error while executing process. Cannot run program "git" (in directory "C:\dev\test"): CreateProcess error=2, Das System kann die angegebene Datei nicht finden

但是,当通过eclipse Run as -> Maven clean verify执行相同的构建时,可以检索提交ID。

由于它在eclipse中工作,我尝试使用maven-scm-provider-jgit而不是maven-scm-provider-gitexebuildnumber-maven-plugin,但显然我没有正确配置它。

这是我的pom.xml的相关部分:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>buildnumber-maven-plugin</artifactId>
    <version>1.4</version>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>create</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <doCheck>false</doCheck>
        <doUpdate>false</doUpdate>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-provider-jgit</artifactId>
            <version>1.9.4</version>
        </dependency>
    </dependencies>
</plugin>

我怎样才能切换到maven-scm-provider-jgit

maven jgit buildnumber-maven-plugin
1个回答
1
投票

buildnumber-maven-plugin需要知道,使用哪个git提供程序。以下配置将git提供程序更改为jgit

由于InfoCommand没有在1.9.5中实现,因此至少需要使用maven-scm-provider-jgit1.9.4版本。

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>buildnumber-maven-plugin</artifactId>
    <version>1.4</version>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>create</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <doCheck>false</doCheck>
        <doUpdate>false</doUpdate>
        <providerImplementations>
            <git>jgit</git>
        </providerImplementations>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-provider-jgit</artifactId>
            <version>1.9.5</version>
        </dependency>
    </dependencies>
</plugin>
© www.soinside.com 2019 - 2024. All rights reserved.