- 配置多环境
dev
dev
true
compile
true
prod
prod
true
- 把需要打包的资源添加进来,不用环境的配置文件放在 env/${profileActive}下,至于加载配置文件,请看我另外一篇文章
${project.artifactId}-${profileActive}-${project.version}
src/main/resources
true
env/${profileActive}/**
statics/**
templates/**
*.xml
*.txt
application-${profileActive}.yml
application.yml
org.springframework.boot
spring-boot-maven-plugin
2.3.4.RELEASE
- 在application.yaml文件中引用profileActive属性,这样在打包的时候只需要执行 mvn -U clean compile package -P prod 就会自动把prod环境的资源都打进去了
spring:
# 环境 dev|test|prod
profiles:
active: @profileActive@