alx3apps/jgit-buildnumber — pull request #3 by plevart (2012-03-29 11:05:25+00:00)
Title: provide JavaScript generated properties

Here's another hack from my part. Use it if you want or drop it.

When I build assemblies with maven, I want generated file names to reflect Git repository info of the source version. For example, we use the following assembly.xml:

<assembly>
<id>${maven.build.timestamp}-${git.branch}-${git.tagOrShortRevision}</id>
...

I want the value of property git.tagOrShortRevision to hold Git tag if the revision I am building is tagged or a short revision id if there is no tag available. I could hard-code that logic into the plug-in itself but that would be of limited use for other users. Rather I came up with a more generic approach which you can review in this pull request. The above property is configured in the pom.xml as follows:

<plugin>
<groupId>ru.concerteza.buildnumber</groupId>
<artifactId>maven-jgit-buildnumber-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>git-buildnumber</id>
<goals>
<goal>extract-buildnumber</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<javaScriptProperties>
<git.tagOrShortRevision>
buildNumber.getTag() == null || buildNumber.getTag().isEmpty()
? buildNumber.getShortRevision()
: buildNumber.getTag()
</git.tagOrShortRevision>
</javaScriptProperties>
</configuration>
</execution>
</executions>
</plugin>

Is this too much?