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

时间:2018-01-09 08:33:07

标签: maven jgit buildnumber-maven-plugin

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

1 个答案:

答案 0 :(得分:1)

.body-common-styles { background: linear-gradient(45deg, #33b1f8 37%, #6e90f6 100%); /*syntax linear-gradient(direction, color1 limit, color2 limit)*/ color: white; font-family: Helvetica; line-height: 1; } .div-common-styles { background-color: #0F2148; } .button-common-styles-normal { /*background: radial-gradient(ellipse,#268ff4 5%,#4da3f8 95%); */ background-color: #4da3f8; border: none; color: white; border-radius: 8px; width: 100px; /* sets the width of the content area to 200 px */ height: 40px; box-sizing: border-box; text-align: center; padding-top: 10px; padding-bottom: 10px; } .button-common-styles-normal:hover { background-color: #268ff4; } .center-horizontally-common-styles { display: block; margin: auto auto; } .centre-vertical-common-styles { position: fixed; left: 50%; /*creates a space equal to 50% from left creating effect of moving the element towards the center horizontally*/ top: 50%; /* creates a space equal to 50% from top creating effect of moving the element towards the center vertically*/ transform: translate(-50%, -50%); } .centre-button-vertical-common-styles { position: absolute; left: 50%; /*creates a space equal to 50% from left creating effect of moving the element towards the center horizontally*/ top: 50%; /* creates a space equal to 50% from top creating effect of moving the element towards the center vertically*/ transform: translate(-50%, -50%); } .debug-border-common-styles { border: 3px solid black; height: 200px; width: 400px; } .css-grid-container-common-styles { height: 100%; display: grid; grid-template-columns: 1fr; /*one column for nav*/ grid-template-rows: auto auto; } .css-grid-item-nav-div { grid-column: 1 / -1; grid-row: 1 / 2; border: 3px solid black; } .css-grid-item-login-div { grid-column: 1 / -1; grid-row: 2 / -1; border: 3px solid black; }需要知道,要使用哪个git提供程序。以下配置将git提供程序更改为<div class="css-grid-container-common-styles"> <nav class="navbar navbar-expand-lg navbar-light bg-light css-grid-item-nav-div"> <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbar1" aria-controls="navbar1" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <a class="navbar-brand" href="index.html">CodingJedi</a> <div class="collapse navbar-collapse justify-content-between" id="navbar1"> <ul class="navbar-nav"> <li class="nav-item active"> <a class="nav-link" href="index.html">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="widgets.html">About</a> </li> </ul> </div> </nav> <div> <div class="css-grid-item-login-div"> <button type="button" class="button-common-styles-normal"> Click Me! </button> </div> </div> </div>

由于buildnumber-maven-plugin未实现InfoCommand,因此必须至少使用jgit的{​​{1}}版本。

1.9.5