When SCM uses git instead of SVN, using MAVEN releases, there are always some baffling questions about Google looking for the reason and inadvertently seeing the plugin;
For the plugin, so far there are fewer documents, especially in Chinese, and all the information is contained in the project documentation; Project Address:
Https://github.com/ktoso/maven-git-commit-id-plugin
The author says the plugin is similar to the Buildnumber-maven-plugin plugin (for the plugin, refer to http://blog.csdn.net/u011453631/article/details/10394475), and extended to it. The Buildnumber-maven-plugin plug-in only supports SVN and CVS, and the plug-in supports Git.
Git-commit-id-plugin is a plugin quite similar to https://fisheye.codehaus.org/browse/mojo/tags/ Buildnumber-maven-plugin-1.0-beta-4 FO example But as BuildNumber only supports SVN (which are very sad) and CVS (which is Even more sad, and makes Bunnies cry) I had to quickly develop a git version of such a plugin.
For English bad I, see English is very painful, in order not to let oneself in the same place pain two times, try to record the use of this plug-in and its configuration, convenient to their own, but also convenient for other English colleagues, if there is ambiguity, please use the original document mainly.
<plugin> <groupId>pl.project13.maven</groupId> <artifactid>git-commit-id-plugin</a
rtifactid> <version>2.1.5</version> <executions> <execution> <goals> <goal>revision</goal> </goals> </execution&
Gt </executions> <configuration> <!--date format; default value: DD. Mm.yyyy ' @ ' HH:mm:ss z;--> <dateFormat>yyyyMMddHHmmss</dateFormat> <!--, build process, print details ; default value:false;--> <verbose>true</verbose> <!--". Git" file path; default: ${project.basedir}/.git; --> <dotGitDirectory>${project.basedir}/.git</dotGitDirectory> <!--If the project package type is POM, whether to cancel the build;
The default value:true;--> <skipPoms>false</skipPoms> <!--whether to generate the Git.properties file;:false;--> <generategitpropertiesfile>true</generategitpropertiesfile> <!--Specify a path to the Git.properties file (relative to ${project.basedir};--> <GENERATEGITPR Whether the build fails when the opertiesfilename>git.properties</generategitpropertiesfilename> <!--". Git" folder is not found, and if you set true, the
The build fails; if you set false, skip the execution of the target; default value:true;--> <failOnNoGitDirectory>true</failOnNoGitDirectory> <!--git describes the configuration, optional, provided by Jgit implementation;--> <gitDescribe> <!--whether to generate a description attribute--> <skip
>false</skip> <!--submit Operation ID is not found when tag is only printed,--> <always>false</always>
<!--commit Action ID Explicit character length, maximum value: 40; Default value: 7;
0 represents a special meaning, followed by an explanation;
--> <abbrev>7</abbrev> <!--build triggers, the code is modified (that is, "dirty State"), and the specified suffix is added; the default value: ";--> <dirty>-dirty</dirty> <!--always print using the "tag-commits_from_tag-g_commit_id
-maybe_dirty "format, even if" on "a tag. The distance would always be 0 if you are "on" the tag. --> <forceLongFormat>false</forceLongFormat> </gitDescribe> </configur Ation> </plugin>