Why does maven: configure profile to always point to dev?

my springboot project is configured in multiple environments. In pom.xml, as follows, I have set test to active, but ${profileActive} always points to dev, unless I delete the profile of dev. What is this about reluctantly pointing to test,?

<profiles>
    <profile>
        <id>test</id>
        <properties>
            <profileActive>test</profileActive>
        </properties>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
    </profile>
    <profile>
        <id>dev</id>
        <properties>
            <profileActive>dev</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.properties</exclude>
                <exclude>application-dev.properties</exclude>
                <exclude>application-test.properties</exclude>
                <exclude>application-prod.properties</exclude>
            </excludes>
        </resource>

        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
            <includes>
                <include>application.properties</include>
                <include>application-${profileActive}.properties</include>
            </includes>
        </resource>
    </resources>
    
    
    
Mar.24,2021

as a matter of fact, maven injection will eventually go through JVM, so I'll give you another way. The problem with your method may lie in ${env}.

spring.profiles.active=${env}

then dynamically control the running environment at the JVM input parameter of the startup class

-Denv=dev 

if you have configuration files such as dev,test,idc, it is very convenient to use this injection method to specify which configuration file the service will run in.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b9ea26-2ec65.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b9ea26-2ec65.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?