Table of contents
  1. CLI
  2. xml
  3. Skip Tests
    1. skip compilation
    2. skip running
    3. xml




CLI

mvn spring-boot:run -Dspring-boot.run.profiles=local    
  • you can provide commandline argument like this:
mvn spring-boot:run -Dspring-boot.run.arguments="--spring.profiles.active=dev"    
    
  • You can provide JVM argument like this:
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dspring.profiles.active=dev"    
  • java -jar
java -Dspring.profiles.active=dev -jar app.jar (VM param)    

or

java -jar app.jar --spring.profiles.active=dev (program param)    

xml


<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <profiles>
                    <profile>dev</profile>
                </profiles>
            </configuration>
        </plugin>
    </plugins>
</build>    

Skip Tests

skip compilation

mvn -Dmaven.test.skip package    

skip running

mvn -DskipTests package    

xml


<properties>
    <maven.test.skip>true</maven.test.skip>
</properties>    

<properties>
    <tests.skip>true</tests.skip>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
    <skipTests>${tests.skip}</skipTests>
</configuration>
</plugin>