吴大宝藏男孩
2019-03-21 15:06Springboot maven filter 打包命令不加 -Pprod 调用生产环境的配置数据吗
5springboot 项目中配置了maven filter
在打包的时候,不使用
mvn clean package -Dmaven.test.skip=true -P prod
打包命令(不包含-P prod)的时候。
如何只通过修改
就能调用到所需要的数据。
下面是POM文件的配置
<profiles><!-- 配置maven filter -->
<profile>
<id>dev</id>
<properties>
<profiles.active>dev</profiles.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>test</id>
<properties>
<profiles.active>test</profiles.active>
</properties>
</profile>
<profile>
<id>production</id>
<properties>
<profiles.active>prod</profiles.active>
</properties>
</profile>
</profiles>
<build>
<filters>
<filter>${project.basedir}/src/main/filters/filter-${profiles.active}.properties</filter>
</filters>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<excludes>
<exclude>**/*.woff</exclude>
<exclude>**/*.woff2</exclude>
<exclude>**/*.ttf</exclude>
</excludes>
<filtering>true</filtering>
</resource>
- 点赞
- 回答
- 收藏
- 复制链接分享
0条回答
为你推荐
- SpringBoot用Maven创建一个微服务,pom中添加依赖以后还是不能引入到项目中
- java
- maven
- intellij-idea
- 3个回答
- Springboot2.2.2不能连接数据库
- spring
- java
- maven
- tomcat
- intellij-idea
- 2个回答
- springboot2.x引入spring-boot-starter-data-redis依赖,启动报错
- spring
- java
- 2个回答
- 求助!!SpringBoot+X-admin 动态表格页面无法显示
- spring
- java
- maven
- eclipse
- 1个回答
- 以前一直好好的 为什么今天springboot的jar包中,parent标签一直报错,我强制更新 maven很多次了,也没用!!!
- java
- java-ee
- spring
- maven
- eclipse
- 7个回答
换一换