Git-commit-id-maven-plugin: Could not complete Mojo execution... (pl.project13.maven:git-commit-id-plugin:2.2.0:revision:default:initialize)

Created on 11 Nov 2015  ·  13Comments  ·  Source: git-commit-id/git-commit-id-maven-plugin

It's the first time I use this plugin, and this problem has troubled me two days. Can anybody help me?

// As a Chinese, I'll try my best to express the question clearly.
// the whitespaces in xml tags are added only here. They are not exist in my files.

I have two projects and poms in eclipse. One is parent and another is son.
The parent's pom is following:
< build>
...

...

< groupId>pl.project13.maven
git-commit-id-plugin


and the son pom is following:
...

parentGroupId
parentArtifacteId
parentVersion

...

The eclipse highlights the line of "here the eclipse show me an error", and the detail of the error is:
Could not complete Mojo execution... (pl.project13.maven:git-commit-id-plugin:2.2.0:revision:default:initialize)

The plugin has been covered by the lifecyclemap as the licecycle mappings metadata of eclipse likes this:

< pluginExecutionFilter>
< groupId>pl.project13.maven
< artifactId>git-commit-id-plugin
< versionRange>[2.1.15,2.2.0]
< goals>
initialize

< /pluginExecutionFilter>
< action>
< ignore />

Could you help me?

Most helpful comment

Hi @diegocos,
Unfortunately I can't speak chinese. What I understood from google translater is that you are struggeling to configure the plugin. Here is an example configuration of the plugin:

          <plugin>
            <groupId>pl.project13.maven</groupId>
            <artifactId>git-commit-id-plugin</artifactId>
            <version>${project.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>revision</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <verbose>true</verbose>
              <skip>false</skip>
              <prefix>git</prefix>
              <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
              <generateGitPropertiesFile>true</generateGitPropertiesFile>
              <generateGitPropertiesFilename>target/testing.properties</generateGitPropertiesFilename>
              <dateFormat>dd.MM.yyyy '@' HH:mm:ss z</dateFormat>
              <dateFormatTimeZone>GMT-08:00</dateFormatTimeZone>
              <useNativeGit>false</useNativeGit>
              <abbrevLength>7</abbrevLength>
              <format>properties</format>
              <gitDescribe>
                <skip>false</skip>
                <always>false</always>
                <abbrev>7</abbrev>
                <match>*</match>
                <dirty>-DEVEL</dirty>
                <forceLongFormat>false</forceLongFormat>
              </gitDescribe>
              <excludeProperties>
                <excludeProperty>git.commit.*</excludeProperty>
                <excludeProperty>git.remote.origin.url</excludeProperty>
              </excludeProperties>
              <failOnNoGitDirectory>false</failOnNoGitDirectory>
              <failOnUnableToExtractRepoInfo>true</failOnUnableToExtractRepoInfo>
            </configuration>
          </plugin>

Hope it helps.

All 13 comments

Eclipe told me more infomation after an update of M2E. The info is as follow:
Could not complete Mojo execution... (pl.project13.maven:git-commit-id-plugin:2.2.0:revision:default:initialize) org.apache.maven.plugin.MojoExecutionException:
Could not complete Mojo execution... at pl.project13.maven.git.GitCommitIdMojo.handlePluginFailure(GitCommitIdMojo.java:504) at
pl.project13.maven.git.GitCommitIdMojo.execute(GitCommitIdMojo.java:440) at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at
org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331) at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at
org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360) at
org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52) at
org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137) at org.eclipse.m2e.core.internal.builder.MavenBuilder
$1.method(MavenBuilder.java:172) at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1) at
org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at org.eclipse.m2e.core.internal.builder.MavenBuilder
$BuildMethod$1.call(MavenBuilder.java:105) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99) at org.eclipse.m2e.core.internal.builder.MavenBuilder
$BuildMethod.execute(MavenBuilder.java:86) at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200) at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:299) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:302) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:
358) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:381) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143) at
org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by:
java.lang.RuntimeException: java.io.IOException: Cannot run program "git" (in directory "F:git\thread\code\thread_common"): CreateProcess error=2, 系统找不到指定
的文件。 at com.google.common.base.Throwables.propagate(Throwables.java:160) at pl.project13.maven.git.NativeGitProvider.runGitCommand(NativeGitProvider.java:
309) at pl.project13.maven.git.NativeGitProvider.getBuildAuthorName(NativeGitProvider.java:75) at
pl.project13.maven.git.GitDataProvider.loadGitData(GitDataProvider.java:102) at
pl.project13.maven.git.GitCommitIdMojo.loadGitDataWithNativeGit(GitCommitIdMojo.java:624) at
pl.project13.maven.git.GitCommitIdMojo.loadGitData(GitCommitIdMojo.java:606) at pl.project13.maven.git.GitCommitIdMojo.execute(GitCommitIdMojo.java:423) ... 32
more Caused by: java.io.IOException: Cannot run program "git" (in directory "F:git\thread\code\thread_common"): CreateProcess error=2, 系统找不到指定的文件。 at
java.lang.ProcessBuilder.start(Unknown Source) at pl.project13.maven.git.NativeGitProvider$JavaProcessRunner.run(NativeGitProvider.java:379) at
pl.project13.maven.git.NativeGitProvider.runGitCommand(NativeGitProvider.java:305) ... 37 more Caused by: java.io.IOException: CreateProcess error=2, 系统找不到指
定的文件。 at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 40
more

The Chinese charactor "系统找不到指定的文件" means "could not find the files".

However, the "dotGitDirectory" was configured in both parent's and son's pom like this:
< dotGitDirectory>F:git\thread.git
but this configuration dosen't work.

well, well, the problem was resovled because of my good luck(are you sure?). The configuration of "useNativeGit" was set to "false", and the dotGitDirectory was set to "F:git\thread.git" as above, then everything is OK now.

However, could anybody explain it? I still have no idea about why the problem happened and how it resovled.

Hi @winters1224,
thanks for reporting your problem here.
The Plugin currently allows two different ways to be executed.
Option 1 is to use the native git (the executable git needs to be installed on your computer)
Option 2 is to use a java git implementation from jgit

the configuration "useNativeGit" switches between those two options. "useNativeGit" = true means that we go for Option 1 and try to use the native git. "useNativeGit" = false means that we go for Option 2 and try to use the java git implementation.
From the Information you have provided it seems that your initial configuration was set to "useNativeGit" = true. However in this case the plugin was unable to find the native executable git binary that needs to be installed on your computer when using this option.

Could you paste the full configuration of the plugin when you had the issue? Was the configuration set to "useNativeGit" = true?

Hi @TheSnoozer , you're exactly right. The configuration was set to "useNativeGit" = true.

I'll check my git installation on my computer. Thank you!

Hi @winters1224,
thanks for the feedback.
We recommend to run the plugin with useNativeGit = false unless you experience slow build times or other problems.
Glad that this already could solve the Problem :-)

To actually run the plugin you do not need to fix your git-Installation since we have the java implementation of git as well :-)

In case you have other Problems or Questions do not hesitate to ask them here :-)

祝你今天愉快 ( hopefully says have a good day :-) )

哥,你说的这个"useNativeGit" = true. 是在哪个文件里面配置的啊?求教~~

我用的sbt,不知道该在什么位置配置呢?

Hi @diegocos,
Unfortunately I can't speak chinese. What I understood from google translater is that you are struggeling to configure the plugin. Here is an example configuration of the plugin:

          <plugin>
            <groupId>pl.project13.maven</groupId>
            <artifactId>git-commit-id-plugin</artifactId>
            <version>${project.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>revision</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <verbose>true</verbose>
              <skip>false</skip>
              <prefix>git</prefix>
              <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
              <generateGitPropertiesFile>true</generateGitPropertiesFile>
              <generateGitPropertiesFilename>target/testing.properties</generateGitPropertiesFilename>
              <dateFormat>dd.MM.yyyy '@' HH:mm:ss z</dateFormat>
              <dateFormatTimeZone>GMT-08:00</dateFormatTimeZone>
              <useNativeGit>false</useNativeGit>
              <abbrevLength>7</abbrevLength>
              <format>properties</format>
              <gitDescribe>
                <skip>false</skip>
                <always>false</always>
                <abbrev>7</abbrev>
                <match>*</match>
                <dirty>-DEVEL</dirty>
                <forceLongFormat>false</forceLongFormat>
              </gitDescribe>
              <excludeProperties>
                <excludeProperty>git.commit.*</excludeProperty>
                <excludeProperty>git.remote.origin.url</excludeProperty>
              </excludeProperties>
              <failOnNoGitDirectory>false</failOnNoGitDirectory>
              <failOnUnableToExtractRepoInfo>true</failOnUnableToExtractRepoInfo>
            </configuration>
          </plugin>

Hope it helps.

@diegocos 是在项目的pom.xml里,plugin里。TheSnoozer贴的配置里已经很清楚了。

@TheSnoozer Thanks. he means "which file could I config the '"useNativeGit" = true'?". You have answered exactly.

@TheSnoozer saved me hours . Thanks a lot .

No issue 👍

If you need more explanation on what the different settings do, I would recommend to checkout the "using the plugin" section in the readme (https://github.com/ktoso/maven-git-commit-id-plugin/#using-the-plugin). Alternatively you also could find a more sophisticated example under the demo profile in the pom of the project (https://github.com/ktoso/maven-git-commit-id-plugin/blob/master/pom.xml#L348).

If you have further questions or issues I would recommend to open up a (new) ticket ;-)

I had same issue with this plugin when having
<excludeProperties> <excludeProperty> </excludeProperty> </excludeProperties>
In nutshell this should not cause problem. In windows it was working fine but started giving issue on linux.

By removing above mentioned and using _useNativeGit: true_ solved the problem.

Hope it'll help others

I met the same issue today,glad to have you guys here.
I'll try it out^_^

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sunnyverma88 picture sunnyverma88  ·  5Comments

Randgalt picture Randgalt  ·  5Comments

darrenbkl picture darrenbkl  ·  3Comments

danh-fissara picture danh-fissara  ·  4Comments

TheSnoozer picture TheSnoozer  ·  7Comments