Adding git information to your Spring Actuator Info endpoint with Gradle


This is how you can add git related information in case you need that to keep track what functionality and code your development or test environments are using.


First you need to add the following to your Gradle file:

plugins {
   id "com.gorylenko.gradle-git-properties" version "1.4.21"

apply plugin: 'com.gorylenko.gradle-git-properties'

After this you should have a new Gradle task that will generate a file that your Actuator Info Endpoint can use. This file by default is generated into the build path resources folder. So run this command before building your jar or docker image etc.

gradle generateGitProperties


If you want to access the Info actutor enpoint to display that info from somewhere else you can do this:
InfoEndpoint infoEndpoint;

return new JSONObject(this.infoEndpoint.invoke()).toString();



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.