【问题标题】:Add VERSION_INFO to jar将 VERSION_INFO 添加到 jar
【发布时间】:2017-05-23 09:41:36
【问题描述】:
如何使用 spring boot 将 VERSION_INFO 元数据添加到 jar 中?
我看过插件
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
执行“重新打包”,但我无法在我的可执行 jar 文件中添加此 meta_data。
【问题讨论】:
标签:
spring-boot
spring-boot-maven-plugin
【解决方案1】:
你真的需要META-INF/MANIFEST.MF中的版本吗?
如果您将这些占位符添加到 application.yml 属性文件:
# app name and build version updated during build process from Maven properties.
info:
app:
name: @project.artifactId@
build:
version: @project.version@
它们在构建工件时被替换,并且在向 /info actuator 端点发送 GET 请求时可用,例如:
curl "http://localhost:8080/info"
{"app":{"name":"demo-cxf"},"build":{"version":"0-SNAPSHOT"}}