@@ -195,9 +195,20 @@ exposed. For example, you could add the following to your `application.propertie
195
195
info.app.version=1.0.0
196
196
----
197
197
198
- If you are using Maven, you can automatically expand info properties from the Maven
199
- project using resource filtering. In your `pom.xml` you have (inside the `<build/>`
200
- element):
198
+
199
+
200
+ [[production-ready-application-info-automatic-expansion]]
201
+ ==== Automatically expand info properties at build time
202
+ Rather than hardcoding some properties that are also specified in your project's
203
+ build configuration, you can automatically expand info properties using the
204
+ existing build configuration instead. This is possible in both Maven and Gradle.
205
+
206
+
207
+
208
+ [[production-ready-application-info-automatic-expansion-maven]]
209
+ ===== Automatic property expansion using Maven
210
+ You can automatically expand info properties from the Maven project using resource
211
+ filtering. In your `pom.xml` you have (inside the `<build/>` element):
201
212
202
213
[source,xml,indent=0]
203
214
----
@@ -228,6 +239,29 @@ fallbacks if the Maven resource filtering has not been switched on for some reas
228
239
229
240
230
241
242
+ [[production-ready-application-info-automatic-expansion-gradle]]
243
+ ===== Automatic property expansion using Gradle
244
+ You can automatically expand info properties from the Gradle project by configuring
245
+ the Java plugin's `processResources` task to do so:
246
+
247
+ [source,groovy,indent=0]
248
+ ----
249
+ processResources {
250
+ expand(project.properties)
251
+ }
252
+ ----
253
+
254
+ You can then refer to your Gradle project's properties via placeholders, e.g.
255
+
256
+ [source,properties,indent=0]
257
+ ----
258
+ info.build.name=${name}
259
+ info.build.description=${description}
260
+ info.build.version=${version}
261
+ ----
262
+
263
+
264
+
231
265
[[production-ready-git-commit-information]]
232
266
==== Git commit information
233
267
Another useful feature of the `info` endpoint is its ability to publish information
0 commit comments