-
引入maven打包插件
<build> <plugins> <!-- 打包时生成打包时间 --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> <version>3.2.0</version> <configuration> <timestampFormat>yyyy-MM-dd HH:mm:ss</timestampFormat> </configuration> <executions> <execution> <goals> <goal>create-timestamp</goal> </goals> </execution> </executions> <inherited>false</inherited> </plugin> </plugins> <!-- maven打包时包含静态资源文件 --> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.yaml</include> <include>META-INF/**</include> <include>**/*.xml</include> </includes> <!-- true表示maven会对文件进行过滤,将@project.version@替换为该属性的值 --> <filtering>true</filtering> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> </resources> </build>
- application.properties内引用
#获取build时的时间 app.buildTime=@timestamp@ #获取项目版本 app.version=@project.version@
Spring Boot 获取maven打包时间
最新推荐文章于 2024-04-30 16:46:47 发布