-1

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 ?

1 Answers1

1

maybe you should use

mvn spring-boot:run -Pdebug
choco
  • 76
  • 2
  • it was the good way ! – it.drive.view Sep 05 '22 at 10:22
  • but i'd like to understand why official documentation does not mention this -P command ! https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/pdf/spring-boot-maven-plugin-reference.pdf. Official documentation mention mvn spring-boot:run -Dapp.profiles= and mvn spring-boot:run -Dspring-boot.run.profiles= which never work !!!! – it.drive.view Sep 05 '22 at 10:59
  • because you put it into profile, so it won't activate if you didn't set -Pdebug but in official document just use app.profiles as a varialbe, so. you can change easily with -Dapp.profiles=test – choco Sep 06 '22 at 02:11