[英]Switch git provider in buildnumber-maven-plugin
When using the buildnumber-maven-plugin
, the execution fails when no git executable is in the %PATH%
during a build on command line: 使用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
However, when executing the same build via eclipse Run as -> Maven clean verify
, a commit id can be retrieved. 但是,当通过eclipse Run as -> Maven clean verify
执行相同的构建时,可以检索提交ID。
Since it works in eclipse, I tried to use the maven-scm-provider-jgit
instead of maven-scm-provider-gitexe
with buildnumber-maven-plugin
, but apparently I did not configure it correctly. 由于它在eclipse中工作,我尝试使用maven-scm-provider-jgit
而不是maven-scm-provider-gitexe
和buildnumber-maven-plugin
,但显然我没有正确配置它。
This is the relevant part of my pom.xml: 这是我的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>
How can I switch to maven-scm-provider-jgit
? 我怎样才能切换到maven-scm-provider-jgit
?
The buildnumber-maven-plugin
needs to know, which git provider to use. buildnumber-maven-plugin
需要知道要使用哪个git提供程序。 The following configuration changes the git provider to jgit
. 以下配置将git提供程序更改为jgit
。
It is necessary to use at least version 1.9.5
of maven-scm-provider-jgit
, since the InfoCommand is not implemented in 1.9.4
. 由于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.