Search code examples
springspring-bootgradlespring-boot-actuatorspring-boot-gradle-plugin

Spring Boot 2.0 Actuator git properties not added to /info


I'm using Gradle with Spring Boot 2.0.0.M7 and have the following plugins applied:

buildscript {
    repositories {
        maven { url "https://plugins.gradle.org/m2/" }
        maven { url "https://repo.spring.io/milestone" }
    }
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M7"
    }
}

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

spring-boot-starter-actuator dependency is also there. git.properties files is generated correctly to build/main/resoures directory. I've also added property management.info.git.mode=full. Due to official docs, git information should be added to /info endpoint automatically with GitInfoContributor. However none of the above helps and /info endpoint returns empty JSON instead - {}. Any ideas on how this can be fixed?

UPDATE 1: What I've found so far is that if I manually copy git.properties to out/resources, this way it would work, but they are not put there for some reason.

UPDATE 2: When I run with gradle bootRun it works, however when I start it from Intellij IDEA our run gradle clean build which runs the test which checks if those properties are displayed on /info endpoint - it doesn't work.


Solution

  • The problem was running the app from IDE. As the properties are generated on the phase when JAR is assembled, they were not included. Running the application via java -jar artifact.jar or gradle bootRun works without any issues.

    Thanks @fateddy for help on resolving the issue.