Add a BuildInfo task for generating build.properties with Gradle

The commit adds a new BuildInfo task that can be used to generate
a build.properties file, intended for inclusion in the Actuator's
info endpoint.

A default instance of the task can be configure using the plugin's
DSL:

springBoot {
	buildInfo()
}

Additional properties can also be configured using the DSL:

springBoot {
	buildInfo {
		additionalProperties = [
			'foo': 'bar'
		]
	}
}

When configured via the DSL, the Java plugin's classes task is
configured to depend on the build info task. Alternatively, if more
control is required, the task can be declared and configured manually:

task buildInfo(type: org.springframework.boot.gradle.buildinfo.BuildInfo) {
	additionalProperties = [
		'foo': 'bar'
	]
}

classes {
	dependsOn buildInfo
}

See gh-2559
This commit is contained in:
Andy Wilkinson
2016-03-23 17:58:54 +00:00
parent 4167469781
commit 58ca9a1c5d
6 changed files with 328 additions and 68 deletions

View File

@@ -22,9 +22,11 @@ apply plugin: 'spring-boot'
jar {
baseName = 'spring-boot-sample-actuator'
version = '0.0.0'
}
group = 'org.springframework.boot'
version = springBootVersion
repositories {
// NOTE: You should declare only repositories that you need here
mavenLocal()
@@ -59,3 +61,7 @@ springBoot {
task wrapper(type: Wrapper) {
gradleVersion = '1.6'
}
springBoot {
buildInfo()
}