spring-boot生成git版本庫(kù)信息
2021-09-14 21:06 作者:向上生長(zhǎng)之路 | 我要投稿
對(duì)于使用git管理的spring-boot工程,通過(guò)配置git-commit-id-plugin,可以實(shí)現(xiàn)生成一份git版本庫(kù)信息文件,結(jié)合spring-boot-actuator提供的端點(diǎn),能方便的查看線(xiàn)上jar包運(yùn)行的git版本庫(kù)相關(guān)信息等

使用方式:在spring-boot工程中,修改pom.xml插件配置
maven插件配置代碼如下
運(yùn)行maven打包指令
在打包好的的jar包中,我們就能看到BOOT-INF\classes下會(huì)生成一個(gè)git.properties文件!

可以打開(kāi)看到文件內(nèi)容

此時(shí)啟動(dòng)工程,通過(guò)spring-boot-starter-actuator提供的/actuator/info端點(diǎn),可以方便的查看到版本庫(kù)信息~

示例代碼:https://github.com/netbuffer/spring-boot-demo
標(biāo)簽: