调整profiles
This commit is contained in:
@@ -183,6 +183,25 @@
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<profiles>
|
||||
<!-- 默认本地开发环境;显式选择 -Pprod 时 Maven 会停用此默认 profile。 -->
|
||||
<profile>
|
||||
<id>local</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<profiles.active>local</profiles.active>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
<properties>
|
||||
<profiles.active>prod</profiles.active>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
@@ -72,7 +72,37 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- 仅过滤主 application.yml 中的 Maven 环境标记;其他配置文件原样复制。 -->
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>application.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
<excludes>
|
||||
<exclude>application.yml</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
<!-- 不处理 Spring 的 ${...} 占位符,只替换 @...@。 -->
|
||||
<useDefaultDelimiters>false</useDefaultDelimiters>
|
||||
<delimiters>
|
||||
<delimiter>@</delimiter>
|
||||
</delimiters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
@@ -99,7 +129,7 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<finalName>${project.artifactId}-${profiles.active}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -56,7 +56,7 @@ spring:
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
# local -> application-local.yml ; prod -> application-prod.yml
|
||||
active: local
|
||||
active: '@profiles.active@'
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
|
||||
Reference in New Issue
Block a user