Maven插件之git-commit-id-plugin2014-03-29 csdn博客 wangjunjun2008SCM使用GIT而非SVN时,使用Maven发布,总是会出一些莫名其妙的问题,google查找原因,无意中看到了 这个插件;对于该插件,到目前为止,文档比较少,尤其是中文的文档;全部的信息都包含在项目说明文件中了;项 目地址:https://github.com/ktoso/maven-git-commit-id-plugin作者说该插件类似于 buildnumber-maven-plugin 插件(关于该插件,可参考 http://blog.csdn.net/u011453631/article/details/10394475),并对其进行了扩展。buildnumber- maven-plugin 插件仅支持SVN和CVS,而该插件又支持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 is very sad) and cvs (which is even more sad, and makes bunnies cry) I had to quickly develop an git version of such a plugin.对于英语不好的我来说,看英语很痛苦,为了不让自己在同一个地方痛苦两次,尝试在此记录下该插件 的使用及其配置,方便自己,也方便其他英语不好的同仁们;如有歧义,请以原版文档为主.
<plugin><groupId>pl.project13.maven</groupId><artifactId>git-commit-id-plugin</artifactId><version>2.1.5</version><executions><execution><goals><goal>revision</goal></goals></execution></executions><configuration><!--日期格式;默认值:dd.MM.yyyy "@" HH:mm:ss z;--><dateFormat>yyyyMMddHHmmss</dateFormat><!--,构建过程中,是否打印详细信息;默认值:false;--><verbose>true</verbose><!-- ".git"文件路径;默认值:${project.basedir}/.git; --><dotGitDirectory>${project.basedir}/.git</dotGitDirectory><!--若项目打包类型为pom,是否取消构建;默认值:true;--><skipPoms>false</skipPoms><!--是否生成"git.properties"文件;默认值:false;--><generateGitPropertiesFile>true</generateGitPropertiesFile><!--指定"git.properties"文件的存放路径(相对于${project.basedir}的一个路径);--><generateGitPropertiesFilename>git.properties</generateGitPropertiesFilename><!--".git"文件夹未找到时,构建是否失败;若设置true,则构建失败;若设置false,则跳过执行该目标;默认值:true;--><failOnNoGitDirectory>true</failOnNoGitDirectory><!--git描述配置,可选;由JGit提供实现;--><gitDescribe><!--是否生成描述属性--><skip>false</skip><!--提交操作未发现tag时,仅打印提交操作ID,--><always>false</always><!--提交操作ID显式字符长度,最大值为:40;默认值:7;0代表特殊意义;后面有解释; --><abbrev>7</abbrev><!--构建触发时,代码有修改时(即"dirty state"),添加指定后缀;默认值:"";--><dirty>-dirty</dirty><!--always print using the "tag-commits_from_tag-g_commit_id-maybe_dirty" format, even if "on" a tag.The distance will always be 0 if you"re "on" the tag.--><forceLongFormat>false</forceLongFormat></gitDescribe></configuration></plugin>