liveBook · Manning

Build information

As explained in Spring in Action, Sixth Edition

Metadata describing an application's project build, including its version, build time, and build environment.

Build information is metadata that identifies an application build, including its version, build timestamp, and build environment. Spring Boot Actuator exposes it through the /info endpoint using BuildInfoContributor. section 15.3.1

Enable build information during the project build:

  • Add the Spring Boot Maven Plugin's build-info goal, or enable buildInfo() in Gradle. section 15.3.1
  • Package the application so the build produces build-info.properties inside the distributable JAR or WAR. section 15.3.1
  • Request /info to inspect the running application's version, build time, host, and build user. section 15.3.1

Example response

A response can identify a Taco Cloud build with artifact "tacocloud", version "0.0.15-SNAPSHOT", and its build timestamp. Git commit information can be exposed alongside it when configured. section 15.3.1

<build>
  <plugins>
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <executions>
        <execution>
          <goals>
            <goal>build-info</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Use the Maven configuration listing to add the build-info goal to a Spring Boot project. section 15.3.1

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains automatic contribution, generated metadata files, Maven and Gradle setup, and returned fields.
Examples
Shows Maven and Gradle configurations plus a Taco Cloud response containing artifact, version, and build time.
What it assumes
Assumes a Spring Boot project using Maven or Gradle and an enabled Actuator /info endpoint.
What you can do after
Operate/configure Spring Boot Actuator to publish build metadata through /info.
How it connects
Connects Spring Boot Actuator, the /info endpoint, InfoContributor, and Git commit information.

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.