2

In a Spring Boot application, I would like to get the build and other application related information in /info actuator endpoint via buildInfo() from springBoot plugin task. However, the build information properties file name is not build-info.properties rather it's different {app_name}.properties. The property file exists in /META-INF/{app_name}.properties in the spring boot created fat jar.

springBoot {
    buildInfo()
}

My question is: Is there any way the property file name can be configured in the task rather than taking default?

Update:

enter image description here

Sujit
  • 468
  • 1
  • 8
  • 22

1 Answers1

2

You misinterpret how buildInfo works. actuator endpoint uses build-info.properties file from /META-INF/. buildInfo configuration does not work in runtime, actually there is no gradle at runtime (that is when your application runs for example on production).

buildInfo() adds a task to you gradle build that can generate build-info.properties based on properties in {app_name}.properties file during build of your application. Given that you already has it you need to run it during the build as described in documentation:

This will configure a BuildInfo task named bootBuildInfo and, if it exists, make the Java plugin’s classes task depend upon it

  • Thanks Roman. The `buildInfo()` task is creating the `build-info.properties` however, and the details is being retrieved in the `/info` end point. However, I am not seeing the properties in the fat jar META-INF folder, where as I am seeing the properties `*-processor-service.properties` in the jar. I am still researching that which task in the project is creating the same which has lot more build information than `build-info.properties`.I am wondering if there is any way I can get the information from `*-processor-service.properties` in the `/info` end point instead of `build-info.properties`. – Sujit Aug 14 '18 at 16:42
  • I think you can using methods described in https://stackoverflow.com/questions/23863972/how-do-i-add-things-to-the-info-endpoint-in-spring-boot-programmatically – Roman-Stop RU aggression in UA Aug 14 '18 at 21:41