Git Commit Information in Spring MVC
Author: Shazin Sadakath
Git Commit Information in Spring MVC
Author: Shazin Sadakath
At time there is a need for developers the need to know which Git Commit from which Git Branch was used to build a release so that they can keep track of the versions.
Spring Boot Actuator is tailor made for this if you are working on Spring Boot but if you are like me and not using Spring Boot for a specific project but only using Spring MVC then this guide will be helpful for you.
First of all you need to add the spring-boot-actuator
org.springframework.boot
spring-boot-actuator
Version
And then instead of relying on Spring Boot Autoconfiguration, in your Java Annotation configuration you can do the following;
@Configuration
@Import({
EndpointWebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
EndpointAutoConfiguration.class
})
And in order to generate the git.properties file you can use the Maven git-commit-id plugin and use it as below;
pl.project13.maven
git-commit-id-plugin
2.2.4
get-the-git-infos
revision
package
validate-the-git-infos
validateRevision
${project.basedir}/../.git
yyyy-MM-dd'T'HH:mm:ssZ
${user.timezone}
true
${project.build.outputDirectory}/git.properties
properties
true
false
true
true
flat
false
true
-dirty
*
false
false
validating project version
${project.version}
And when packaging you can use the following command
$ mvn clean package git-commit-id:revision
Now when you access http://
Интересный пост _________________ [URL=https://zekalocasino.topgameslist.xyz/grand-kazino-bonus-za-registraciyu/]Гранд казино бонус за регистрацию[/URL].
Read MoreДовольно интересно _________________ [URL=https://zekalocasino.topgameslist.xyz/kazino-den-za-registraciyu/]Казино день за регистрацию[/URL].
Read MoreКруто, давно искал _________________ [URL=https://zekalocasino.topgameslist.xyz/kazino-prestizh-registraciya/]Казино престиж регистрация[/URL].
Read MorePlease login or register to post a comment.
There are currently no comments.