This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Boot 3.3.5!

Integrating with Actuator

Generating Build Information

Spring Boot Actuator’s info endpoint automatically publishes information about your build in the presence of a META-INF/build-info.properties file. A BuildInfo task is provided to generate this file. The easiest way to use the task is through the plugin’s DSL:

  • Groovy

  • Kotlin

springBoot {
	buildInfo()
}
springBoot {
	buildInfo()
}

This will configure a BuildInfo task named bootBuildInfo and, if it exists, make the Java plugin’s classes task depend upon it. The task’s destination directory will be META-INF in the output directory of the main source set’s resources (typically build/resources/main).

By default, the generated build information is derived from the project:

Property Default value

build.artifact

The base name of the bootJar or bootWar task

build.group

The group of the project

build.name

The name of the project

build.version

The version of the project

build.time

The time at which the project is being built

The properties can be customized using the DSL:

  • Groovy

  • Kotlin

springBoot {
	buildInfo {
		properties {
			artifact = 'example-app'
			version = '1.2.3'
			group = 'com.example'
			name = 'Example application'
		}
	}
}
springBoot {
	buildInfo {
		properties {
			artifact.set("example-app")
			version.set("1.2.3")
			group.set("com.example")
			name.set("Example application")
		}
	}
}

To exclude any of the default properties from the generated build information, add its name to the excludes. For example, the time property can be excluded as follows:

  • Groovy

  • Kotlin

springBoot {
	buildInfo {
		excludes = ['time']
	}
}
springBoot {
	buildInfo {
		excludes.set(setOf("time"))
	}
}

The default value for build.time is the instant at which the project is being built. A side-effect of this is that the task will never be up-to-date. As a result, builds will take longer as more tasks, including the project’s tests, will have to be executed. Another side-effect is that the task’s output will always change and, therefore, the build will not be truly repeatable. If you value build performance or repeatability more highly than the accuracy of the build.time property, exclude the time property as shown in the preceding example.

Additional properties can also be added to the build information:

  • Groovy

  • Kotlin

springBoot {
	buildInfo {
		properties {
			additional = [
				'a': 'alpha',
				'b': 'bravo'
			]
		}
	}
}
springBoot {
	buildInfo {
		properties {
			additional.set(mapOf(
				"a" to "alpha",
				"b" to "bravo"
			))
		}
	}
}

An additional property’s value can be computed lazily by using a Provider.