从pom获取应用程序版本 [英] Getting application version from pom

查看:303
本文介绍了从pom获取应用程序版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个休息端点用于返回有关应用程序的信息(到目前为止只有应用程序版本)
但到目前为止这个信息是硬编码的,并且很容易忘记更改它。
我最好从pom或manifest文件中检索app版本。是否有任何项目带来这样的功能?

I have a rest endpoint used to return information about application (so far only app version) But so far this info is hardcoded, and it's pretty easy to forget to change it. I will be better to retrieve app version from pom or manifest file. Is there any project that brings such functionality?

推荐答案

有一个名为 Appinfo ,请使用它并享受! (它有一个丑陋的页面,我知道 - 但它有效:)

There is amazing project named Appinfo, please use it and enjoy! (It has an ugly page, I know - but it works :)



AppInfo允许自动提供你的具有当前版本号,构建日期或内部版本号的应用程序。

AppInfo allows to automatically feed your application with a current version number, build date or build number.







同样优秀 Spring Boot Actuator 提供了名为 Info Endpoint ,可以发布版本信息到网络或REST。


Also excellent Spring Boot Actuator provides feature named Info Endpoint which can publish version information to web or REST.



默认情况下,执行器将/ info端点添加到主服务器。它包含来自git.properties的提交和时间戳信息(如果该文件存在)以及它在前缀为info的环境中找到的任何属性。

By default the Actuator adds an /info endpoint to the main server. It contains the commit and timestamp information from git.properties (if that file exists) and also any properties it finds in the environment with prefix "info".


这篇关于从pom获取应用程序版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆