1

I am trying to get git commit details as part of "/actuator/info" api end point using the gradle-git-properties plugin by following https://guides.grails.org/adding-commit-info/guide/index.html guide but having no luck with it. Steps I followed:

  • "sdk install grails 4.0.8" //installing latest grails 4 version using sdkman
  • "sdk use grails 4.0.8" //making sure my current shell is using latest version as well
  • "grails create-app myapp --profile=rest-api" //creating a dummy app
  • "cd myapp" //change working dir to the new app
  • "git init" //initializing git
  • As per the guide I updated the build.gradle
          buildscript {
              repositories {
                  maven { url "https://repo.grails.org/grails/core" }
                  maven { url "https://plugins.gradle.org/m2/" }
              }
              dependencies {
                  classpath "org.grails:grails-gradle-plugin:$grailsVersion"
                  classpath "org.grails.plugins:hibernate5:7.0.4"
                  classpath "org.grails.plugins:views-gradle:2.0.2"
                  classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:2.2.0"
              }
          }
    
          version "0.1"
          group "myapp"
    
          apply plugin:"eclipse"
          apply plugin:"idea"
          apply plugin:"war"
          apply plugin:"org.grails.grails-web"
          apply plugin:"org.grails.plugins.views-json"
          apply plugin: "com.gorylenko.gradle-git-properties"
    
  • Also updated the application.yml file to enable actuator end points
          management:
              endpoints:
                  enabled-by-default: true
    
  • run the application using ./gradlew bootRun

I see that the git.properties file is correctly generated and placed under "build/resources/main" folder within the project folder. But when I hit "http://localhost:8080/actuator/info" in browser, all I see is:

{"app":{"grailsVersion":"4.0.8","version":"0.1","name":"myapp"}}

But no git related info. Raised the same issue here are well: https://github.com/n0mer/gradle-git-properties/issues/161

Deewendra Shrestha
  • 2,313
  • 1
  • 23
  • 53

1 Answers1

1

Solution has been provided by @virtualdogbert here : https://github.com/n0mer/gradle-git-properties/issues/161#issuecomment-936544990

Basically we have to set path to the git.properties file for dev env:

environments {
    development{
        spring.info.git.location='file:build/resources/main/git.properties'
    }
}
Deewendra Shrestha
  • 2,313
  • 1
  • 23
  • 53