Search code examples
mavenprofilespring-boot-maven-plugin

maven profile activated but do not execute spring profile work


in a maven multi modules project, i have a configuration like this below..

<profiles>
    <profile>
        <id>debug</id>
        <activation>
            <property>
                <name>debug</name>
                <value>true</value>
            </property>
        </activation>
        <properties>
            <spring.profiles.active>dev</spring.profiles.active>
        </properties>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <jvmArguments>-Dapp.basedir=${project.build.directory} -Xmx256M
                            -XX:+UseG1GC -Xdebug
                            -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8003</jvmArguments>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

when i launch application with the command line :

mvn spring-boot:run -Dspring-boot.run.profiles=debug

the terminal linux stack says :

c.a.epr.core.SpringApplication          : The following profiles are active: debug

but the behaviour of the application is like a NO PROFILE behaviour. What gets wrong with my configuration ?


Solution

  • maybe you should use

    mvn spring-boot:run -Pdebug