如何在不更改 pom.xml 的情况下在 pom.properties 文件中获取构建时间戳

问题描述

最近我在做一个项目,它有一个子部分需要通过 jar 文件检查应用程序的构建时间和版本,所以当使用 springboot 1.3.5.RELEASE 和运行命令“mvn package”时,我能够获取jar文件,访问jar文件里面的pom.properties,可以得到构建时间和构建版本,内容如下-

#Generated by Maven
#Tue Jun 29 13:45:25 IST 2021
version=1.3.6.RELEASE
groupId=org.springframework.boot
artifactId=SpringBootMavenExample

但是现在springboot迁移到2.X版本后,访问pom.properties时,只能得到-

version=1.3.6.RELEASE
groupId=org.springframework.boot
artifactId=SpringBootMavenExample

在 pom.properties 文件中,我可以通过添加 pom.xml、maven.buildtimestamp 来获取时间戳和版本,但我不想在 pom 中做任何更改,因为起初也可以从 pom 中获取时间戳。属性

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)