Maven plugin which includes build-time git repository information into an POJO / *.properties). Make your apps tell you which version exactly they were built from! Priceless in large distributed deployments... :-)
Version 4.0.4 is finally there and includes various bug-fixes and improvements :-)
The main key-aspects that have been improved or being worked on are the following:
NullPointerException
when session.getProjectDependencyGraph()
might be null
when running the plugin from eclipsegit.commit.author.time
, git.commit.committer.time
)The plugin is available from Maven Central (see here), so you don't have to configure any additional repositories to use this plugin. All you need to do is to configure it inside your project as dependency:
<dependency>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.4</version>
</dependency>
If you can't wait for the next release, you can also get the latest snapshot version from sonatype, that is being deployed automatically by travis:
<pluginRepositories>
<pluginRepository>
<id>sonatype-snapshots</id>
<name>Sonatype Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
Even though travis will only deploy a new snapshot once all tests have finished, it is recommended to rely on the released and more stable version.
mvn com.test.plugins:myPlugin:myMojo
) might result in unresolved properties even with <injectAllReactorProjects>true</injectAllReactorProjects>
. Please refer to https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/287 or https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/413#issuecomment-487952607 for details and potential workaroundsIf you find any problem with this plugin, feel free to report it here
Version 4.0.3 is finally there and includes various bug-fixes and improvements :-)
The main key-aspects that have been improved or being worked on are the following:
The plugin is available from Maven Central (see here), so you don't have to configure any additional repositories to use this plugin. All you need to do is to configure it inside your project as dependency:
<dependency>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.3</version>
</dependency>
If you can't wait for the next release, you can also get the latest snapshot version from sonatype, that is being deployed automatically by travis:
<pluginRepositories>
<pluginRepository>
<id>sonatype-snapshots</id>
<name>Sonatype Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
Even though travis will only deploy a new snapshot once all tests have finished, it is recommended to rely on the released and more stable version.
mvn com.test.plugins:myPlugin:myMojo
) might result in unresolved properties even with <injectAllReactorProjects>true</injectAllReactorProjects>
. Please refer to https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/287 or https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/413#issuecomment-487952607 for details and potential workaroundsIf you find any problem with this plugin, feel free to report it here
Version 4.0.2 is finally there and includes various bug-fixes and improvements :-)
The main key-aspects that have been improved or being worked on are the following:
injectAllReactorProjects
git.build.time
from project.build.outputTimestamp
to support reproducible buildsjgit 5.8.1.202007141445-r
, jackson-databind 2.11.2
, joda-time 2.10.6
The plugin is available from Maven Central (see here), so you don't have to configure any additional repositories to use this plugin. All you need to do is to configure it inside your project as dependency:
<dependency>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.2</version>
</dependency>
If you can't wait for the next release, you can also get the latest snapshot version from sonatype, that is being deployed automatically by travis:
<pluginRepositories>
<pluginRepository>
<id>sonatype-snapshots</id>
<name>Sonatype Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
Even though travis will only deploy a new snapshot once all tests have finished, it is recommended to rely on the released and more stable version.
mvn com.test.plugins:myPlugin:myMojo
) might result in unresolved properties even with <injectAllReactorProjects>true</injectAllReactorProjects>
. Please refer to https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/287 or https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/413#issuecomment-487952607 for details and potential workaroundsIf you find any problem with this plugin, feel free to report it here
Version 4.0.1 is finally there and includes various bug-fixes and improvements :-)
The main key-aspects that have been improved or being worked on are the following:
git.branch
and git.build.number
for GitHub ActionsforceValueEvaluation
-switch to the replacementProperty
to tell the plugin that the value needs to be regenerated for every project. Note that this will make the plugin run for every project (e.g. which might be needed for sonar that requires unique keys for the sonar)https://:@git.server.com/pathToRepo.git
)git.branch
and git.build.number
for AWS CodeBuildThe plugin is available from Maven Central (see here), so you don't have to configure any additional repositories to use this plugin. All you need to do is to configure it inside your project as dependency:
<dependency>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.1</version>
</dependency>
If you can't wait for the next release, you can also get the latest snapshot version from sonatype, that is being deployed automatically by travis:
<pluginRepositories>
<pluginRepository>
<id>sonatype-snapshots</id>
<name>Sonatype Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
Even though travis will only deploy a new snapshot once all tests have finished, it is recommended to rely on the released and more stable version.
mvn com.test.plugins:myPlugin:myMojo
) might result in unresolved properties even with <injectAllReactorProjects>true</injectAllReactorProjects>
. Please refer to https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/287 or https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/413#issuecomment-487952607 for details and potential workaroundsIf you find any problem with this plugin, feel free to report it here
Version 4.0.0 is finally there and includes various bug-fixes, improvements and some changes that can be considered as potential breaking changes :-)
The main key-aspects that have been improved or being worked on are the following:
maven
and a core
-project) -- https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/441 (initial idea https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/228)runOnlyOnce
coupled with Maven's --projects
parameter makes plugin not run at all -- https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/387, https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/443
injectAllReactorProjects
slightly less verbose -- https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/431
useNativeGit
from command line via -Dmaven.gitcommitid.nativegit=true
-- https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/433
git.branch
and git.build.number
for Azure DevOps -- https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/439
git.branch
and git.build.number
for CircleCI -- https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/449
git.branch
in sonar's project version:<replacementProperties>
<replacementProperty>
<property>sonar.projectVersion</property>
<token>^.*$</token>
<value>${project.version}-${git.branch}</value>
<regex>false</regex>
</replacementProperty>
</replacementProperties>
See https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/444 for further details.
The plugin is available from Maven Central (see here), so you don't have to configure any additional repositories to use this plugin. All you need to do is to configure it inside your project as dependency:
<dependency>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.0</version>
</dependency>
If you can't wait for the next release, you can also get the latest snapshot version from sonatype, that is being deployed automatically by travis:
<pluginRepositories>
<pluginRepository>
<id>sonatype-snapshots</id>
<name>Sonatype Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
Even though travis will only deploy a new snapshot once all tests have finished, it is recommended to rely on the released and more stable version.
mvn com.test.plugins:myPlugin:myMojo
) might result in unresolved properties even with <injectAllReactorProjects>true</injectAllReactorProjects>
. Please refer to https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/287 or https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/413#issuecomment-487952607 for details and potential workaroundsorg.eclipse.jgit.api.errors.TransportException: USERAUTH fail
under java 13 (I can't reproduce the issue), however a workaround would be specifying <offline>true</offline>
or using the native git implementation with <useNativeGit>true</useNativeGit>
.If you find any problem with this plugin, feel free to report it here
Version 3.0.1 is finally there and includes various bug-fixes and improvements :-)
The main key-aspects that have been improved or being worked on are the following:
git fetch
operation to determine the properties git.local.branch.ahead
and git.local.branch.behind
. If the plugin is operating in 'offline' mode both those properties will only reflect the view of the local clone and thus might be off from the actual repository. Note this 'offline' mode is also respected when one set's the maven "-o" offline switch).org.apache.httpcomponents:httpclient
dependency -- https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/425
git.build.time
since the TimeZone.getTimeZone()
may also have an impact upon performance -- https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/428.injectAllReactorProjects
-- https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/429.The plugin is available from Maven Central (see here), so you don't have to configure any additional repositories to use this plugin. All you need to do is to configure it inside your project as dependency:
<dependency>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>3.0.1</version>
</dependency>
If you can't wait for the next release, you can also get the latest snapshot version from sonatype, that is being deployed automatically by travis:
<pluginRepositories>
<pluginRepository>
<id>sonatype-snapshots</id>
<name>Sonatype Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
Even though travis will only deploy a new snapshot once all tests have finished, it is recommended to rely on the released and more stable version.
mvn com.test.plugins:myPlugin:myMojo
) might result in unresolved properties even with <injectAllReactorProjects>true</injectAllReactorProjects>
. Please refer to https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/287 or https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/413#issuecomment-487952607 for details and potential workaroundsIf you find any problem with this plugin, feel free to report it here
Version 3.0.0 is finally there and includes various bug-fixes and improvements :-)
The main key-aspects that have been improved or being worked on are the following:
<useBranchNameFromBuildEnvironment>false</useBranchNameFromBuildEnvironment>
). This behaviour might be useful in combination with the JGitflow maven plugin #393.git-commit-id
organization account #384git.local.branch.ahead
and git.local.branch.behind
that provide some information if the local branch is either ahead or behind the remote. Note that using this property will perform a git fetch
operation and may have a performance impact on the overall execution of the plugin. #395git fetch
operation performed when gathering the properties git.local.branch.ahead
and git.local.branch.behind
simply exclude those to avoid that step:<excludeProperties>
<excludeProperty>^git.local.branch.*$</excludeProperty>
</excludeProperties>
evaluateOnCommit
to anything besides the default HEAD
resulted only in the commit-id. in case users want to evaluateOnCommit
on any commit or branch that is not the default HEAD
, please be advised that this plugin will run git branch --points-at
that may or may not result in a git.branch
property that has multiple branches that are comma separated. If evaluateOnCommit
is kept as the default HEAD
the git.branch
property still may fallback to the commit-id. #403injectAllReactorProjects
to true for multi-modules project now stores the computed properties in the project context. If the properties are present in the project context this plugin will essentially reuse those properties from a previously computed version (kudus to https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/411, implemented in https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/414)The plugin is available from Maven Central (see here), so you don't have to configure any additional repositories to use this plugin. All you need to do is to configure it inside your project as dependency:
<dependency>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>3.0.0</version>
</dependency>
If you can't wait for the next release, you can also get the latest snapshot version from sonatype, that is being deployed automatically by travis:
<pluginRepositories>
<pluginRepository>
<id>sonatype-snapshots</id>
<name>Sonatype Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
Even though travis will only deploy a new snapshot once all tests have finished, it is recommended to rely on the released and more stable version.
mvn com.test.plugins:myPlugin:myMojo
) might result in unresolved properties even with <injectAllReactorProjects>true</injectAllReactorProjects>
. Please refer to https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/287 or https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/413#issuecomment-487952607 for details and potential workaroundsIf you find any problem with this plugin, feel free to report it here
Version 2.2.6 is a security update for a potential issue within the jackson-databind dependency. As usual you can checkout the detailed list of bug-fixes :-)
The main key-aspects is a security update for a potential issue within the jackson-databind dependency. This specific dependency was updated to v2.9.8 in response to https://github.com/FasterXML/jackson-databind/issues/2186 (CVE-2018-19360, CVE-2018-19361, CVE-2018-19362). Even though by default an user of this plugin does not seem to be affected by this potential issue, it is highly recommended to adopt the latest version at your earliest convenience. Similar to version 2.2.5 this version provides full support for Java 7, Java 8, Java 9, Java 10 and Java 11 (and is potentially also working for any higher version).
The specific issues that have been fixed with the update of jackson-databind dependency are:
This plugin uses the jackson-databind dependency for dumping the git information (serialization) to the generated properties file and determining if the generated json properties are up-to-date (deserialization). As of now it appears that only user who generate json properties via <format>json</format>
may be affected by those issues. This specific configuration is set to <format>properties</format>
by default and hence by default it appears that those issues are out of scope. Only when this configuration is altered a user may need to consider the linked CVE's as potential security problem.
In general I would be unsure if this ever even could be considered a true attack vector of this plugin, since the generated json file would need to contain data that would trigger this specific bug in the dependency. If an adversary has access to the content to the location where the generated file is residing, I would assume he can also modify the any local file (including project files) and hence would not need to go through the pain and exploit this problem....
The plugin is available from Maven Central (see here), so you don't have to configure any additional repositories to use this plugin. All you need to do is to configure it inside your project as dependency:
<dependency>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.6</version>
</dependency>
If you find any problem with this plugin, feel free to report it here
Version 2.2.5 is finally there and includes various bug-fixes and improvements :-)
The main key-aspects that have been improved or being worked on are the following:
git.build.number
and git.build.number.unique
) for Bamboo, Hudson, Jenkins, TeamCity, Travis, Gitlab CI - https://github.com/ktoso/maven-git-commit-id-plugin/issues/353 / https://github.com/ktoso/maven-git-commit-id-plugin/pull/369
git.branch
support for GitlabCI - https://github.com/ktoso/maven-git-commit-id-plugin/pull/368
The plugin is available from Maven Central (see here), so you don't have to configure any additional repositories to use this plugin. All you need to do is to configure it inside your project as dependency:
<dependency>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.5</version>
</dependency>
If you find any problem with this plugin, feel free to report it here
Version 2.2.4 is finally there and includes various bug-fixes and improvements :-)
The main key-aspects that have been improved or being worked on are the following:
-Dmaven.gitcommitid.skip=true
does not skip the plugin execution when the configuration in the POM includes a <skip>false</skip>
- https://github.com/ktoso/maven-git-commit-id-plugin/issues/315
transformationRules
for the property where those rules should take effect. Each transformationRule
consist of two required fields apply
and action
. The apply
-tag controls when the rule should be applied and can be set to BEFORE
to have the rule being applied before or it can be set to AFTER
to have the rule being applied after the replacement. The action
-tag determines the string conversion rule that should be applied. Currenlty supported is LOWER_CASE
and UPPER_CASE
. Potential candidates in the feature are CAPITALIZATION
and INVERT_CASE
(open a ticket if you need them...).<replacementProperties>
<!-- example: apply replacement only to the specific property git.branch and replace '/' with '-' -->
<replacementProperty>
<property>git.branch</property>
<!-- will not overwrite the existing property and generate a new `git.branch.something` -->
<propertyOutputSuffix>something</propertyOutputSuffix>
<token>^([^\/]*)\/([^\/]*)$</token>
<value>$1-$2</value>
<regex>true</regex>
<transformationRules>
<transformationRule>
<apply>BEFORE</apply>
<action>UPPER_CASE</action>
</transformationRule>
<transformationRule>
<apply>AFTER</apply>
<action>LOWER_CASE</action>
</transformationRule>
</transformationRules>
</replacementProperty>
</replacementProperties>
See https://github.com/ktoso/maven-git-commit-id-plugin/issues/317 for more details on a use-case.
mvn clean verify -Pcheckstyle -Dmaven.test.skip=true -B
for java 7 and java 8. For java9 one may want to run mvn clean verify -Pcheckstyle -Dcheckstyle.version=8.2 -Dmaven.test.skip=true -B
that uses a more recent checkstyle version. Feel free to check out our FAQ-Section in the Readme that contains a small write up on how you can integrate checkstyle into your IDE. git.closest.tag.name
and git.closest.tag.count
now will be determined based on properties configured inside the git-describe command (https://github.com/ktoso/maven-git-commit-id-plugin/issues/221). Example:<gitDescribe>
<tags>true</tags>
</gitDescribe>
will cause that lightweight tags are also included for the closest tags
Also the pattern
used inside the gitDescribe might have an impact on the resulting git.closest.tag.name
and git.closest.tag.count
git.tags
property (basically it wasn't reporting all tags of a given commit) - https://github.com/ktoso/maven-git-commit-id-plugin/issues/339
HEAD
which should reference to the latest commit in your repository. In general this property can be set to something generic like HEAD^1
or point to a branch or tag-name. To support any kind or use-case this configuration can also be set to an entire commit-hash or it's abbreviated version. Please note that for security purposes not all references might be allowed as configuration.
The configuration can be used in the following:<evaluateOnCommit>HEAD</evaluateOnCommit>
The plugin is available from Maven Central (see here), so you don't have to configure any additional repositories to use this plugin. All you need to do is to configure it inside your project as dependency:
<dependency>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.4</version>
</dependency>
If you find any problem with this plugin, feel free to report it here