Affichage des articles dont le libellé est short revision. Afficher tous les articles
Affichage des articles dont le libellé est short revision. Afficher tous les articles

jeudi 9 février 2012

Maven BuildNumber plugin - short revision id for Git

Today, I would like to explain the improvement for maven plugin - buildNumber, that I talked in my previous message - short revision id for Git SCM.

IMPORTANT : This feature is present in the maven-buildnumber-plugin 1.1 version.

You can specify the length for the Git revision. To enable this feature you have to specify the new tag
<shortRevisionLength>
in the
<configuration>
section. For exemple:

The associated maven output informs us about the detection of shortRevisionLength tag and print the length of the revision that will be used in buildNumber formatting:


Some implementation details

This feature uses internally the git rev-pasre --short (see associated git help section) command and the revision length is set to minimum 4 characters. So you can't have the revision id shorter then 4 characters. Even if you specify the length between 0 and 4, the plugin will inform you about this situation and the minimum value (4) will be used.

UPDATED: If your maven build can't find the dependency for maven-buildnumber-plugin 1.1 , try to force the dependency update  by adding option "-U" for your mvn command.