springboot 提示这个The following 1 profile is active: "@profile.active@"的问题解决
plugin配置 有重点说明
一、maven 中profiles 需要配置
例如:
<profiles>
<profile>
<id>dev</id>
<properties>
<profile.active>dev</profile.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>prod</id>
<properties>
<profile.active>prod</profile.active>
</properties>
</profile>
</profiles>
二、build 配置
<resources>
<resource>
<directory>src/main/resources/</directory>
<filtering>true</filtering>
<!-- 表示哪些资源内容需要打包 -->
<includes>
<include>static/**</include>
<include>templates/**</include>
<include>*.xml</include>
<include>*.yaml</include>
<include>application.yml</include>
<include>application-${profile.active}.yml</include>
</includes>
</resource>
</resources>
三、plugin配置
重点说明delimiter 这个节点,它表示引用占位符,是application.yml 中引用@profile.active@ 时使用的符号。只有符号匹配才能被正确引用,否则占位符不合,将无法正常被引用
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<delimiters>
<delimiter>@</delimiter>
</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>