與 Actuator 整合
如果存在 META-INF/build-info.properties 檔案,Spring Boot Actuator 會顯示與構建相關的資訊。build-info 目標會生成包含專案座標和構建時間的檔案。它還允許你新增任意數量的附加屬性,如下例所示
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>build-info</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<encoding.source>UTF-8</encoding.source>
<encoding.reporting>UTF-8</encoding.reporting>
<java.version>${java.version}</java.version>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
此配置將在預期位置生成一個包含三個附加鍵的 build-info.properties。
java.version 預計是專案中可用的常規屬性。它將按你預期的方式進行插值。 |
spring-boot:build-info
org.springframework.boot:spring-boot-maven-plugin:4.0.0
根據當前 MavenProject 的內容生成 build-info.properties 檔案。
可選引數
| 名稱 | 型別 | 預設值 |
|---|---|---|
|
||
|
||
|
|
|
|
|
|
|
|
引數詳情
additionalProperties
要儲存在 build-info.properties 檔案中的附加屬性。在生成的 build-info.properties 中,每個條目都以 build. 為字首。
名稱 |
|
|---|---|
型別 |
|
預設值 |
|
使用者屬性 |
|
自 |
excludeInfoProperties
應從 build-info.properties 檔案中排除的屬性。可用於排除標準 group、artifact、name、version 或 time 屬性以及 additionalProperties 中的專案。
名稱 |
|
|---|---|
型別 |
|
預設值 |
|
使用者屬性 |
|
自 |