maven打包springboot项目,配置文件外置

时间:2021-08-25 23:39:12   收藏:0   阅读:21

在POM.XML的<build></build>中配置如下:

        <resources>
            <resource>
                <directory>src\main\resources</directory>
                <excludes>
                    <exclude>application.properties</exclude>
                    <exclude>log4j2.xml</exclude>
                </excludes>
            </resource>
        </resources>

这句话就可以不把配置文件打包到JAR中。

启动方式,指定logging的配置即可。

java -jar hxgw-1.0-SNAPSHOT.jar --logging.config=./log4j2.xml

 

原文:https://www.cnblogs.com/yoyotl/p/15187415.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!