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.
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.
You can configure your IDE to call the process-resources maven goal, prior to the Build/Launch, this will cause the git.properties file and build-info.properties files to be generated prior to the application launching.
I use Maven, but a similar configuration should be possible for Gradle.
For IntelliJ IDEA, you can enable Delegate IDE build/run actions to Gradle option in Settings (Preferences) | Build, Execution, Deployment | Build Tools | Gradle | Runner tab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With