maven打包动态替换配置文件的值
maven打包动态替换配置文件的值
pom文件添加
<profiles>
<profile>
<id>dev</id>
<properties>
<profileActive>dev</profileActive>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>test</id>
<properties>
<profileActive>test</profileActive>
</properties>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<filtering>true</filtering>属性用来表示资源文件中的占位符是否需要被替换,true为需要替换。
例如如下配置:
spring:
application:
name: test
profiles:
active: @profileActive@
若 maven命令为:clean install -Dmaven.test.skip=true -Ptest
则:@profileActive@被替换为:test
完整:
spring:
application:
name: test
profiles:
active: test
若 maven命令为:clean install -Dmaven.test.skip=true -Pdev
则:@profileActive@被替换为:dev
完整:
spring:
application:
name: test
profiles:
active: dev
猜你喜欢
框架
972
maven打包连同依赖的jar包一起打包的插件plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-assembly-plugin
blog
SpringBoot打包分离资源文件
框架
3478
SpringBoot打包分离资源文件springboot项目打包时,把资源文件,如配置文件,静态资源文件等分离出来,避免为了修改资源文件时重新打包。方式11.pom文件buildplugins
框架
7497
多么痛的领悟~分离资源打包后运行项目,启动失败数据源初始化失败~检查问题,这种情况下没有打印错误日志,首先配置一下日志,将错误报告在控制台中打印出来。resources文件夹下创建一个
spring/springmvc
6970
springboot动态设置@RequestMapping的url请求路径(从配置文件中获取或默认)controller层
spring/springmvc
1250
yml配置文件:sys:qq_back:http://www.123.club/indexesqq_appid:1018qq_appkey:025bf1d0配置类
jenkins,软件使用
991
,可以方便查找编译以及打包的文件。三、源码构建选择git选项,在Credentials中点击添加按钮,添加git的登录用户名和密码,或者是配置公钥。添加完成用户以后填写RepositoryURL(代码库
blog
linux系统maven环境变量配置
linux系统
1018
-Xmx1024m"exportPATH=$M2_HOME/bin:$PATH使生效:source/etc/profile配置maven仓库:setting.xml配置文件中在各自的标签中添加:mirrorida
框架
903
-warn"/appender-refref="file-error"//root/configuration不同级别的日志由不同的appender处理。二、application.yml配置日志的文件存放目
归档
2018年11月
12
2018年12月
33
2019年01月
28
2019年02月
28
2019年03月
32
2019年04月
27
2019年05月
33
2019年06月
6
2019年07月
12
2019年08月
12
2019年09月
21
2019年10月
8
2019年11月
15
2019年12月
25
2020年01月
9
2020年02月
5
2020年03月
16
2020年04月
4
2020年06月
1
2020年07月
7
2020年08月
13
2020年09月
9
2020年10月
5
2020年12月
3
2021年01月
1
2021年02月
5
2021年03月
7
2021年04月
4
2021年05月
4
2021年06月
1
2021年07月
7
2021年08月
2
2021年09月
8
2021年10月
9
2021年11月
16
2021年12月
14
2022年01月
7
2022年05月
1
2022年08月
3
2022年09月
2
2022年10月
2
2022年12月
5
2023年01月
3
2023年02月
1
2023年03月
4
2023年04月
2
标签
算法基础
linux
前端
c++
数据结构
框架
数据库
计算机基础
储备知识
java基础
ASM
其他
深入理解java虚拟机
nginx
git
消息中间件
搜索
maven
redis
docker
dubbo
vue
导入导出
软件使用
idea插件
协议
无聊的知识
jenkins
springboot
mqtt协议
keepalived
minio
mysql
ensp
网络基础
xxl-job
rabbitmq
haproxy
srs
音视频
webrtc
目录
没有一个冬天不可逾越,没有一个春天不会来临。最慢的步伐不是跬步,而是徘徊,最快的脚步不是冲刺,而是坚持。