美文网首页
spring-boot生成打包信息

spring-boot生成打包信息

作者: 向上生长之路 | 来源:发表于2021-09-18 21:42 被阅读0次

    通过配置spring-boot-maven-plugin,可以实现生成一份maven打包信息文件,来方便查看线上jar包运行的版本信息等

    maven插件配置代码如下

       <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>build-info</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    

    运行maven打包指令

    mvn clean package

    在打包好的的jar包中,我们就能看到META-INF下会生成一个build-info.properties文件!

    可以打开看到文件内容

    另外,可以通过访问spring-boot-starter-actuator提供的/actuator/info端点,来查看到打包信息~

    GET /actuator/info

    示例代码:https://github.com/netbuffer/spring-boot-demo

    相关文章

      网友评论

          本文标题:spring-boot生成打包信息

          本文链接:https://www.haomeiwen.com/subject/foiygltx.html