Document build-time property expansion using Gradle

Closes gh-1540
pull/1588/head
Andy Wilkinson 10 years ago
parent 3c815f4014
commit 2ba2cfe23d

@ -195,9 +195,20 @@ exposed. For example, you could add the following to your `application.propertie
info.app.version=1.0.0 info.app.version=1.0.0
---- ----
If you are using Maven, you can automatically expand info properties from the Maven
project using resource filtering. In your `pom.xml` you have (inside the `<build/>`
element): [[production-ready-application-info-automatic-expansion]]
==== Automatically expand info properties at build time
Rather than hardcoding some properties that are also specified in your project's
build configuration, you can automatically expand info properties using the
existing build configuration instead. This is possible in both Maven and Gradle.
[[production-ready-application-info-automatic-expansion-maven]]
===== Automatic property expansion using Maven
You can automatically expand info properties from the Maven project using resource
filtering. In your `pom.xml` you have (inside the `<build/>` element):
[source,xml,indent=0] [source,xml,indent=0]
---- ----
@ -228,6 +239,29 @@ fallbacks if the Maven resource filtering has not been switched on for some reas
[[production-ready-application-info-automatic-expansion-gradle]]
===== Automatic property expansion using Gradle
You can automatically expand info properties from the Gradle project by configuring
the Java plugin's `processResources` task to do so:
[source,groovy,indent=0]
----
processResources {
expand(project.properties)
}
----
You can then refer to your Gradle project's properties via placeholders, e.g.
[source,properties,indent=0]
----
info.build.name=${name}
info.build.description=${description}
info.build.version=${version}
----
[[production-ready-git-commit-information]] [[production-ready-git-commit-information]]
==== Git commit information ==== Git commit information
Another useful feature of the `info` endpoint is its ability to publish information Another useful feature of the `info` endpoint is its ability to publish information

Loading…
Cancel
Save