1

I use git-commit-id-plugin in my pom.xml as follows:

<plugin>
      <groupId>pl.project13.maven</groupId>
      <artifactId>git-commit-id-plugin</artifactId>
      <version>4.9.10</version>
      <executions>
        <execution>
          <goals>
            <goal>revision</goal>
          </goals>
        </execution>
      </executions>
      <configuration>
        <dotGitDirectory>${project.basedir}/../../.git</dotGitDirectory>
        <generateGitPropertiesFile>true</generateGitPropertiesFile>
        <generateGitPropertiesFilename>src/main/resources/git.properties</generateGitPropertiesFilename>
      </configuration>
    </plugin>

Then I build my maven project by Jenkins, in the generated git.properties, the value of git.branch is identical to the value of git.commit.id, what I want is the git branch name, why would this happened, and how do I solve this? Any idea is appreciated.

Min Chen
  • 75
  • 1
  • 6

1 Answers1

0

This happened to me, I updated the plugin with the latest version (5.0.0) and now it works (I'm using maven 4.0.0), here is my configuration:

<plugin>
                <groupId>io.github.git-commit-id</groupId>
                <artifactId>git-commit-id-maven-plugin</artifactId>
                <version>5.0.0</version>
                <executions>
                    <execution>
                        <id>get-the-git-infos</id>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                        <phase>initialize</phase>
                    </execution>
                </executions>
                <configuration>
                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
                    <generateGitPropertiesFilename>${project.build.sourceDirectory}/../resources/application.properties</generateGitPropertiesFilename>
                    <includeOnlyProperties>
                        <includeOnlyProperty>git.branch</includeOnlyProperty>
                    </includeOnlyProperties>
                </configuration>
            </plugin>