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
评论区
请写下您的评论...
猜你喜欢
框架
1663
maven打包连同依赖的jar包一起打包的插件plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-assembly-plugin
blog
SpringBoot打包分离资源文件
框架
4177
SpringBoot打包分离资源文件springboot项目打包时,把资源文件,如配置文件,静态资源文件等分离出来,避免为了修改资源文件时重新打包。方式11.pom文件buildplugins
框架
8094
多么痛的领悟~分离资源打包后运行项目,启动失败数据源初始化失败~检查问题,这种情况下没有打印错误日志,首先配置一下日志,将错误报告在控制台中打印出来。resources文件夹下创建一个
maven
1046
build
plugins
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-shade-plugin/artifactId
version3.2.4/version!--使用最新版本--
executions
execution
phasepackage/phase
goals
goalshade/goal
/goals
spring/springmvc
9578
springboot动态设置@RequestMapping的url请求路径(从配置文件中获取或默认)controller层
spring/springmvc
2832
yml配置文件:sys:qq_back:http://www.123.club/indexesqq_appid:1018qq_appkey:025bf1d0配置类
jenkins,软件使用
1647
,可以方便查找编译以及打包的文件。三、源码构建选择git选项,在Credentials中点击添加按钮,添加git的登录用户名和密码,或者是配置公钥。添加完成用户以后填写RepositoryURL(代码库
blog
linux系统maven环境变量配置
linux系统
1605
-Xmx1024m"exportPATH=$M2_HOME/bin:$PATH使生效:source/etc/profile配置maven仓库:setting.xml配置文件中在各自的标签中添加:mirrorida
最新发表
归档
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
2023-06
3
2023-07
4
2023-08
1
2023-10
1
2024-02
1
2024-03
1
2024-04
1
2024-08
1
标签
算法基础
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
javascript
加密算法
目录
没有一个冬天不可逾越,没有一个春天不会来临。最慢的步伐不是跬步,而是徘徊,最快的脚步不是冲刺,而是坚持。