@@ -306,11 +306,14 @@ git.commit.user.email=${git.commit.user.email}
306306git.commit.message.full=${git.commit.message.full}
307307git.commit.message.short=${git.commit.message.short}
308308git.commit.time=${git.commit.time}
309+ git.closest.tag.name=${git.closest.tag.name}
310+ git.closest.tag.commit.count=${git.closest.tag.commit.count}
309311
310312git.build.user.name=${git.build.user.name}
311313git.build.user.email=${git.build.user.email}
312314git.build.time=${git.build.time}
313315git.build.host=${git.build.host}
316+ git.build.version=${git.build.version}
314317```
315318
316319The ` git ` prefix may be configured in the plugin declaration above.
@@ -341,11 +344,14 @@ Start out with with adding the above steps to your project, next paste this **gi
341344 <property name =" commitMessageFull" value =" ${git.commit.message.full}" />
342345 <property name =" commitMessageShort" value =" ${git.commit.message.short}" />
343346 <property name =" commitTime" value =" ${git.commit.time}" />
347+ <property name =" closestTagName" value =" ${git.closest.tag.name}" />
348+ <property name =" closestTagCommitCount" value =" ${git.closest.tag.commit.count}" />
344349
345350 <property name =" buildUserName" value =" ${git.build.user.name}" />
346351 <property name =" buildUserEmail" value =" ${git.build.user.email}" />
347352 <property name =" buildTime" value =" ${git.build.time}" />
348353 <property name =" buildHost" value =" ${git.build.host}" />
354+ <porperty name =" buildVersion" value =" ${git.build.version}" />
349355 </bean >
350356</beans >
351357```
@@ -378,12 +384,15 @@ public class GitRepositoryState {
378384 String commitMessageFull; // =${git.commit.message.full}
379385 String commitMessageShort; // =${git.commit.message.short}
380386 String commitTime; // =${git.commit.time}
387+ String closestTagName; // =${git.closest.tag.name}
388+ String closestTagCommitCount; // =${git.closest.tag.commit.count}
381389
382390 String buildUserName; // =${git.build.user.name}
383391 String buildUserEmail; // =${git.build.user.email}
384392 String buildTime; // =${git.build.time}
385393 String buildHost; // =${git.build.host}
386-
394+ String buildVersion // =${git.build.version}
395+
387396 public GitRepositoryState () {
388397 }
389398 /* Generate setters and getters here */
@@ -438,11 +447,14 @@ In the end *this is what this service would return*:
438447 + added license etc",
439448 "commitMessageShort" : " releasing my fun plugin :-)" ,
440449 "commitTime" : " 06.01.1970 @ 16:16:26 CET" ,
450+ "closestTagName" : " v2.1.0" ,
451+ "closestTagCommitCount" : " 2" ,
441452
442453 "buildUserName" : " Konrad Malawski" ,
443454 "buildUserEmail" :
" [email protected] " ,
444455 "buildTime" : " 06.01.1970 @ 16:17:53 CET" ,
445- "buildHost" : " github.com"
456+ "buildHost" : " github.com" ,
457+ "buildVersion" : " v2.1.0-SNAPSHOT"
446458 }
447459```
448460
@@ -503,11 +515,14 @@ public GitRepositoryState(Properties properties)
503515 this . commitMessageFull = properties. get(" git.commit.message.full" ). toString();
504516 this . commitMessageShort = properties. get(" git.commit.message.short" ). toString();
505517 this . commitTime = properties. get(" git.commit.time" ). toString();
518+ this . closestTagName = properties. get(" git.closest.tag.name" ). toString();
519+ this . closestTagCommitCount = properties. get(" git.closest.tag.commit.count" ). toString();
506520
507521 this . buildUserName = properties. get(" git.build.user.name" ). toString();
508522 this . buildUserEmail = properties. get(" git.build.user.email" ). toString();
509523 this . buildTime = properties. get(" git.build.time" ). toString();
510524 this . buildHost = properties. get(" git.build.host" ). toString();
525+ this . buildVersion = properties. get(" git.build.version" ). toString();
511526}
512527```
513528
0 commit comments