'Maven clean test not picking profile

I have a Maven Spring boot selenium project with TestNg. I am able to run test scripts through eclipse by running a Maven building using goal 'clean package' and adding spring.profiles.active=local in environment. I am running the same using comment prompt using the following command.

mvn clean test -P local -Dsurefire.suiteXmlFiles=testng.xml

I get an error 'No active profile set, falling back to default profiles: default'.

What is wrong in here and how I can fix.

<profiles>
    
        <profile>
            <id>local</id>
                        <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <spring.profiles.active>local</spring.profiles.active>
            </properties>
            <build>
                <directory>target/local</directory>
                <finalName>local</finalName>
            </build>
        </profile>
        
        <profile>
            <id>dev</id>
            <properties>                
                <web.context.root>project</web.context.root>
                <build_number></build_number>
            </properties>
                        <build>
                <directory>target/dev</directory>
                <finalName>project-dev</finalName>
            </build>
        </profile>
        
        <profile>
            <id>systest</id>
            <properties>
                <spring.profiles.active>systest</spring.profiles.active>
                <web.context.root>project</web.context.root>
                <build_number></build_number>
            </properties>
                        <build>
                <directory>target/systest</directory>
                <finalName>project-systest</finalName>
            </build>
        </profile>
        

    </profiles> 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source