I have the following code snippet in a parent root pom
set dev as the default profile
<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>
<profile>
<id>prod</id>
<properties>
<profileActive>prod</profileActive>
</properties>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>application-dev.yml</exclude>
<exclude>application-test.yml</exclude>
<exclude>application-prod.yml</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>application-${profileActive}.yml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<delimiters>
<delimiter>@</delimiter>
</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>
</plugins>
</build>
then a springboot project references that the pom is parent
there is an application.yml application-dev.yml application-test.yml
under the resource of this project, and the following is in the application.yml:
spring:
profiles:
active: @profileActive@
if I package and transfer this project to the linux server to run, I correctly adopt the default profile of dev, and the log is
.2019-01-18 00 INFO
-[main] c.u.i.k.p.myproject.MyApplication: The following profiles are active: dev but if I click to debug and run
under IDEA (the red warning in the picture is for privacy, I don"t want to disclose the specific project and class name, it"s scribbled, it"s just showing the configuration here)
No configuration
then there will be
2019-01-17 1633 c.u.i.k.p.myproject.MyApplication INFO 12044-[main] c.u.i.k.p.myproject.MyApplication: No active profile set, falling back to default profiles: default
Excuse me, what"s going on?