簡體   English   中英

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

[英]Switch git provider in buildnumber-maven-plugin

使用buildnumber-maven-plugin ,如果在命令行上構建期間沒有git可執行文件位於%PATH%中,則執行失敗:

 [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

buildnumber-maven-plugin需要知道要使用哪個git提供程序。 以下配置將git提供程序更改為jgit

由於InfoCommand未在1.9.4實現,因此至少需要使用maven-scm-provider-jgit 1.9.5版本。

<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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM