This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Boot 3.3.4!spring-doc.cn

This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Boot 3.3.4!spring-doc.cn

While you may start your Spring Boot application very easily from your test (or test suite) itself, it may be desirable to handle that in the build itself. To make sure that the lifecycle of your Spring Boot application is properly managed around your integration tests, you can use the start and stop goals, as shown in the following example:spring-doc.cn

<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
			<executions>
				<execution>
					<id>pre-integration-test</id>
					<goals>
						<goal>start</goal>
					</goals>
				</execution>
				<execution>
					<id>post-integration-test</id>
					<goals>
						<goal>stop</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

Such setup can now use the failsafe-plugin to run your integration tests as you would expect.spring-doc.cn

The application is started in a separate process and JMX is used to communicate with the application. By default, the plugin uses port 9001. If you need to configure the JMX port, see the dedicated example.

You could also configure a more advanced setup to skip the integration tests when a specific property has been set, see the dedicated example.spring-doc.cn

The application is started in a separate process and JMX is used to communicate with the application. By default, the plugin uses port 9001. If you need to configure the JMX port, see the dedicated example.

Using Failsafe Without Spring Boot’s Parent POM

Spring Boot’s Parent POM, spring-boot-starter-parent, configures Failsafe’s <classesDirectory> to be ${project.build.outputDirectory}. Without this configuration, which causes Failsafe to use the compiled classes rather than the repackaged jar, Failsafe cannot load your application’s classes. If you are not using the parent POM, you should configure Failsafe in the same way, as shown in the following example:spring-doc.cn

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-failsafe-plugin</artifactId>
	<configuration>
		<classesDirectory>${project.build.outputDirectory}</classesDirectory>
	</configuration>
</plugin>

spring-boot:start

org.springframework.boot:spring-boot-maven-plugin:3.4.0-SNAPSHOTspring-doc.cn

Start a spring application. Contrary to the run goal, this does not block and allows other goals to operate on the application. This goal is typically used in integration test scenario where the application is started before a test suite and stopped after.spring-doc.cn

Required parameters

Name Type Default

classesDirectoryspring-doc.cn

Filespring-doc.cn

${project.build.outputDirectory}spring-doc.cn

Parameter details

addResources

Add maven resources to the classpath directly, this allows live in-place editing of resources. Duplicate resources are removed from target/classes to prevent them from appearing twice if ClassLoader.getResources() is called. Please consider adding spring-boot-devtools to your project instead as it provides this feature and many more.spring-doc.cn

Namespring-doc.cn

addResourcesspring-doc.cn

Typespring-doc.cn

booleanspring-doc.cn

Default valuespring-doc.cn

falsespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.addResourcesspring-doc.cn

Sincespring-doc.cn

1.0.0spring-doc.cn

additionalClasspathElements

Additional classpath elements that should be added to the classpath. An element can be a directory with classes and resources or a jar file.spring-doc.cn

Namespring-doc.cn

additionalClasspathElementsspring-doc.cn

Typespring-doc.cn

java.lang.String[]spring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.additional-classpath-elementsspring-doc.cn

Sincespring-doc.cn

3.2.0spring-doc.cn

agents

Path to agent jars.spring-doc.cn

Namespring-doc.cn

agentsspring-doc.cn

Typespring-doc.cn

java.io.File[]spring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.agentsspring-doc.cn

Sincespring-doc.cn

2.2.0spring-doc.cn

arguments

Arguments that should be passed to the application.spring-doc.cn

Namespring-doc.cn

argumentsspring-doc.cn

Typespring-doc.cn

java.lang.String[]spring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

1.0.0spring-doc.cn

classesDirectory

Directory containing the classes and resource files that should be used to run the application.spring-doc.cn

Namespring-doc.cn

classesDirectoryspring-doc.cn

Typespring-doc.cn

java.io.Filespring-doc.cn

Default valuespring-doc.cn

${project.build.outputDirectory}spring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

1.0.0spring-doc.cn

commandlineArguments

Arguments from the command line that should be passed to the application. Use spaces to separate multiple arguments and make sure to wrap multiple values between quotes. When specified, takes precedence over #arguments.spring-doc.cn

Namespring-doc.cn

commandlineArgumentsspring-doc.cn

Typespring-doc.cn

java.lang.Stringspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.argumentsspring-doc.cn

Sincespring-doc.cn

2.2.3spring-doc.cn

environmentVariables

List of Environment variables that should be associated with the forked process used to run the application.spring-doc.cn

Namespring-doc.cn

environmentVariablesspring-doc.cn

Typespring-doc.cn

java.util.Mapspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

2.1.0spring-doc.cn

excludeGroupIds

Comma separated list of groupId names to exclude (exact match).spring-doc.cn

Namespring-doc.cn

excludeGroupIdsspring-doc.cn

Typespring-doc.cn

java.lang.Stringspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.excludeGroupIdsspring-doc.cn

Sincespring-doc.cn

1.1.0spring-doc.cn

excludes

Collection of artifact definitions to exclude. The Exclude element defines mandatory groupId and artifactId components and an optional classifier component. When configured as a property, values should be comma-separated with colon-separated components: groupId:artifactId,groupId:artifactId:classifierspring-doc.cn

Namespring-doc.cn

excludesspring-doc.cn

Typespring-doc.cn

java.util.Listspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.excludesspring-doc.cn

Sincespring-doc.cn

1.1.0spring-doc.cn

includes

Collection of artifact definitions to include. The Include element defines mandatory groupId and artifactId components and an optional classifier component. When configured as a property, values should be comma-separated with colon-separated components: groupId:artifactId,groupId:artifactId:classifierspring-doc.cn

Namespring-doc.cn

includesspring-doc.cn

Typespring-doc.cn

java.util.Listspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.includesspring-doc.cn

Sincespring-doc.cn

1.2.0spring-doc.cn

jmxName

The JMX name of the automatically deployed MBean managing the lifecycle of the spring application.spring-doc.cn

Namespring-doc.cn

jmxNamespring-doc.cn

Typespring-doc.cn

java.lang.Stringspring-doc.cn

Default valuespring-doc.cn

org.springframework.boot:type=Admin,name=SpringApplicationspring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

jmxPort

The port to use to expose the platform MBeanServer.spring-doc.cn

Namespring-doc.cn

jmxPortspring-doc.cn

Typespring-doc.cn

intspring-doc.cn

Default valuespring-doc.cn

9001spring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

jvmArguments

JVM arguments that should be associated with the forked process used to run the application. On command line, make sure to wrap multiple values between quotes.spring-doc.cn

Namespring-doc.cn

jvmArgumentsspring-doc.cn

Typespring-doc.cn

java.lang.Stringspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.jvmArgumentsspring-doc.cn

Sincespring-doc.cn

1.1.0spring-doc.cn

mainClass

The name of the main class. If not specified the first compiled class found that contains a 'main' method will be used.spring-doc.cn

Namespring-doc.cn

mainClassspring-doc.cn

Typespring-doc.cn

java.lang.Stringspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.main-classspring-doc.cn

Sincespring-doc.cn

1.0.0spring-doc.cn

maxAttempts

The maximum number of attempts to check if the spring application is ready. Combined with the "wait" argument, this gives a global timeout value (30 sec by default)spring-doc.cn

Namespring-doc.cn

maxAttemptsspring-doc.cn

Typespring-doc.cn

intspring-doc.cn

Default valuespring-doc.cn

60spring-doc.cn

User propertyspring-doc.cn

spring-boot.start.maxAttemptsspring-doc.cn

Sincespring-doc.cn

noverify

Flag to say that the agent requires -noverify.spring-doc.cn

Namespring-doc.cn

noverifyspring-doc.cn

Typespring-doc.cn

booleanspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.noverifyspring-doc.cn

Sincespring-doc.cn

1.0.0spring-doc.cn

profiles

The spring profiles to activate. Convenience shortcut of specifying the 'spring.profiles.active' argument. On command line use commas to separate multiple profiles.spring-doc.cn

Namespring-doc.cn

profilesspring-doc.cn

Typespring-doc.cn

java.lang.String[]spring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.profilesspring-doc.cn

Sincespring-doc.cn

1.3.0spring-doc.cn

skip

Skip the execution.spring-doc.cn

Namespring-doc.cn

skipspring-doc.cn

Typespring-doc.cn

booleanspring-doc.cn

Default valuespring-doc.cn

falsespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.skipspring-doc.cn

Sincespring-doc.cn

1.3.2spring-doc.cn

systemPropertyVariables

List of JVM system properties to pass to the process.spring-doc.cn

Namespring-doc.cn

systemPropertyVariablesspring-doc.cn

Typespring-doc.cn

java.util.Mapspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

2.1.0spring-doc.cn

useTestClasspath

Flag to include the test classpath when running.spring-doc.cn

Namespring-doc.cn

useTestClasspathspring-doc.cn

Typespring-doc.cn

java.lang.Booleanspring-doc.cn

Default valuespring-doc.cn

falsespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.useTestClasspathspring-doc.cn

Sincespring-doc.cn

wait

The number of milliseconds to wait between each attempt to check if the spring application is ready.spring-doc.cn

Namespring-doc.cn

waitspring-doc.cn

Typespring-doc.cn

longspring-doc.cn

Default valuespring-doc.cn

500spring-doc.cn

User propertyspring-doc.cn

spring-boot.start.waitspring-doc.cn

Sincespring-doc.cn

workingDirectory

Current working directory to use for the application. If not specified, basedir will be used.spring-doc.cn

Namespring-doc.cn

workingDirectoryspring-doc.cn

Typespring-doc.cn

java.io.Filespring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.workingDirectoryspring-doc.cn

Sincespring-doc.cn

1.5.0spring-doc.cn

Name Type Default

classesDirectoryspring-doc.cn

Filespring-doc.cn

${project.build.outputDirectory}spring-doc.cn

Name Type Default

addResourcesspring-doc.cn

booleanspring-doc.cn

falsespring-doc.cn

additionalClasspathElementsspring-doc.cn

String[]spring-doc.cn

agentsspring-doc.cn

File[]spring-doc.cn

argumentsspring-doc.cn

String[]spring-doc.cn

commandlineArgumentsspring-doc.cn

Stringspring-doc.cn

environmentVariablesspring-doc.cn

Mapspring-doc.cn

excludeGroupIdsspring-doc.cn

Stringspring-doc.cn

excludesspring-doc.cn

Listspring-doc.cn

includesspring-doc.cn

Listspring-doc.cn

jmxNamespring-doc.cn

Stringspring-doc.cn

org.springframework.boot:type=Admin,name=SpringApplicationspring-doc.cn

jmxPortspring-doc.cn

intspring-doc.cn

9001spring-doc.cn

jvmArgumentsspring-doc.cn

Stringspring-doc.cn

mainClassspring-doc.cn

Stringspring-doc.cn

maxAttemptsspring-doc.cn

intspring-doc.cn

60spring-doc.cn

noverifyspring-doc.cn

booleanspring-doc.cn

profilesspring-doc.cn

String[]spring-doc.cn

skipspring-doc.cn

booleanspring-doc.cn

falsespring-doc.cn

systemPropertyVariablesspring-doc.cn

Mapspring-doc.cn

useTestClasspathspring-doc.cn

Booleanspring-doc.cn

falsespring-doc.cn

waitspring-doc.cn

longspring-doc.cn

500spring-doc.cn

workingDirectoryspring-doc.cn

Filespring-doc.cn

Namespring-doc.cn

addResourcesspring-doc.cn

Typespring-doc.cn

booleanspring-doc.cn

Default valuespring-doc.cn

falsespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.addResourcesspring-doc.cn

Sincespring-doc.cn

1.0.0spring-doc.cn

Namespring-doc.cn

additionalClasspathElementsspring-doc.cn

Typespring-doc.cn

java.lang.String[]spring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.additional-classpath-elementsspring-doc.cn

Sincespring-doc.cn

3.2.0spring-doc.cn

Namespring-doc.cn

agentsspring-doc.cn

Typespring-doc.cn

java.io.File[]spring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.agentsspring-doc.cn

Sincespring-doc.cn

2.2.0spring-doc.cn

Namespring-doc.cn

argumentsspring-doc.cn

Typespring-doc.cn

java.lang.String[]spring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

1.0.0spring-doc.cn

Namespring-doc.cn

classesDirectoryspring-doc.cn

Typespring-doc.cn

java.io.Filespring-doc.cn

Default valuespring-doc.cn

${project.build.outputDirectory}spring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

1.0.0spring-doc.cn

Namespring-doc.cn

commandlineArgumentsspring-doc.cn

Typespring-doc.cn

java.lang.Stringspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.argumentsspring-doc.cn

Sincespring-doc.cn

2.2.3spring-doc.cn

Namespring-doc.cn

environmentVariablesspring-doc.cn

Typespring-doc.cn

java.util.Mapspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

2.1.0spring-doc.cn

Namespring-doc.cn

excludeGroupIdsspring-doc.cn

Typespring-doc.cn

java.lang.Stringspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.excludeGroupIdsspring-doc.cn

Sincespring-doc.cn

1.1.0spring-doc.cn

Namespring-doc.cn

excludesspring-doc.cn

Typespring-doc.cn

java.util.Listspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.excludesspring-doc.cn

Sincespring-doc.cn

1.1.0spring-doc.cn

Namespring-doc.cn

includesspring-doc.cn

Typespring-doc.cn

java.util.Listspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.includesspring-doc.cn

Sincespring-doc.cn

1.2.0spring-doc.cn

Namespring-doc.cn

jmxNamespring-doc.cn

Typespring-doc.cn

java.lang.Stringspring-doc.cn

Default valuespring-doc.cn

org.springframework.boot:type=Admin,name=SpringApplicationspring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

Namespring-doc.cn

jmxPortspring-doc.cn

Typespring-doc.cn

intspring-doc.cn

Default valuespring-doc.cn

9001spring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

Namespring-doc.cn

jvmArgumentsspring-doc.cn

Typespring-doc.cn

java.lang.Stringspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.jvmArgumentsspring-doc.cn

Sincespring-doc.cn

1.1.0spring-doc.cn

Namespring-doc.cn

mainClassspring-doc.cn

Typespring-doc.cn

java.lang.Stringspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.main-classspring-doc.cn

Sincespring-doc.cn

1.0.0spring-doc.cn

Namespring-doc.cn

maxAttemptsspring-doc.cn

Typespring-doc.cn

intspring-doc.cn

Default valuespring-doc.cn

60spring-doc.cn

User propertyspring-doc.cn

spring-boot.start.maxAttemptsspring-doc.cn

Sincespring-doc.cn

Namespring-doc.cn

noverifyspring-doc.cn

Typespring-doc.cn

booleanspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.noverifyspring-doc.cn

Sincespring-doc.cn

1.0.0spring-doc.cn

Namespring-doc.cn

profilesspring-doc.cn

Typespring-doc.cn

java.lang.String[]spring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.profilesspring-doc.cn

Sincespring-doc.cn

1.3.0spring-doc.cn

Namespring-doc.cn

skipspring-doc.cn

Typespring-doc.cn

booleanspring-doc.cn

Default valuespring-doc.cn

falsespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.skipspring-doc.cn

Sincespring-doc.cn

1.3.2spring-doc.cn

Namespring-doc.cn

systemPropertyVariablesspring-doc.cn

Typespring-doc.cn

java.util.Mapspring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

2.1.0spring-doc.cn

Namespring-doc.cn

useTestClasspathspring-doc.cn

Typespring-doc.cn

java.lang.Booleanspring-doc.cn

Default valuespring-doc.cn

falsespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.useTestClasspathspring-doc.cn

Sincespring-doc.cn

Namespring-doc.cn

waitspring-doc.cn

Typespring-doc.cn

longspring-doc.cn

Default valuespring-doc.cn

500spring-doc.cn

User propertyspring-doc.cn

spring-boot.start.waitspring-doc.cn

Sincespring-doc.cn

Namespring-doc.cn

workingDirectoryspring-doc.cn

Typespring-doc.cn

java.io.Filespring-doc.cn

Default valuespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.workingDirectoryspring-doc.cn

Sincespring-doc.cn

1.5.0spring-doc.cn

spring-boot:stop

org.springframework.boot:spring-boot-maven-plugin:3.4.0-SNAPSHOTspring-doc.cn

Stop an application that has been started by the "start" goal. Typically invoked once a test suite has completed.spring-doc.cn

Optional parameters

Name Type Default

jmxNamespring-doc.cn

Stringspring-doc.cn

org.springframework.boot:type=Admin,name=SpringApplicationspring-doc.cn

jmxPortspring-doc.cn

intspring-doc.cn

9001spring-doc.cn

skipspring-doc.cn

booleanspring-doc.cn

falsespring-doc.cn

Parameter details

jmxName

The JMX name of the automatically deployed MBean managing the lifecycle of the application.spring-doc.cn

Namespring-doc.cn

jmxNamespring-doc.cn

Typespring-doc.cn

java.lang.Stringspring-doc.cn

Default valuespring-doc.cn

org.springframework.boot:type=Admin,name=SpringApplicationspring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

jmxPort

The port to use to look up the platform MBeanServer.spring-doc.cn

Namespring-doc.cn

jmxPortspring-doc.cn

Typespring-doc.cn

intspring-doc.cn

Default valuespring-doc.cn

9001spring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

skip

Skip the execution.spring-doc.cn

Namespring-doc.cn

skipspring-doc.cn

Typespring-doc.cn

booleanspring-doc.cn

Default valuespring-doc.cn

falsespring-doc.cn

User propertyspring-doc.cn

spring-boot.stop.skipspring-doc.cn

Sincespring-doc.cn

1.3.2spring-doc.cn

Name Type Default

jmxNamespring-doc.cn

Stringspring-doc.cn

org.springframework.boot:type=Admin,name=SpringApplicationspring-doc.cn

jmxPortspring-doc.cn

intspring-doc.cn

9001spring-doc.cn

skipspring-doc.cn

booleanspring-doc.cn

falsespring-doc.cn

Namespring-doc.cn

jmxNamespring-doc.cn

Typespring-doc.cn

java.lang.Stringspring-doc.cn

Default valuespring-doc.cn

org.springframework.boot:type=Admin,name=SpringApplicationspring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

Namespring-doc.cn

jmxPortspring-doc.cn

Typespring-doc.cn

intspring-doc.cn

Default valuespring-doc.cn

9001spring-doc.cn

User propertyspring-doc.cn

Sincespring-doc.cn

Namespring-doc.cn

skipspring-doc.cn

Typespring-doc.cn

booleanspring-doc.cn

Default valuespring-doc.cn

falsespring-doc.cn

User propertyspring-doc.cn

spring-boot.stop.skipspring-doc.cn

Sincespring-doc.cn

1.3.2spring-doc.cn

Examples

Random Port for Integration Tests

One nice feature of the Spring Boot test integration is that it can allocate a free port for the web application. When the start goal of the plugin is used, the Spring Boot application is started separately, making it difficult to pass the actual port to the integration test itself.spring-doc.cn

The example below showcases how you could achieve the same feature using the Build Helper Maven Plugin:spring-doc.cn

<build>
	<plugins>
		<plugin>
			<groupId>org.codehaus.mojo</groupId>
			<artifactId>build-helper-maven-plugin</artifactId>
			<executions>
				<execution>
					<id>reserve-tomcat-port</id>
					<goals>
						<goal>reserve-network-port</goal>
					</goals>
					<phase>process-resources</phase>
					<configuration>
						<portNames>
							<portName>tomcat.http.port</portName>
						</portNames>
					</configuration>
				</execution>
			</executions>
		</plugin>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
			<executions>
				<execution>
					<id>pre-integration-test</id>
					<goals>
						<goal>start</goal>
					</goals>
					<configuration>
						<arguments>
							<argument>--server.port=${tomcat.http.port}</argument>
						</arguments>
					</configuration>
				</execution>
				<execution>
					<id>post-integration-test</id>
					<goals>
						<goal>stop</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-failsafe-plugin</artifactId>
			<configuration>
				<systemPropertyVariables>
					<test.server.port>${tomcat.http.port}</test.server.port>
				</systemPropertyVariables>
			</configuration>
		</plugin>
	</plugins>
</build>

You can now retrieve the test.server.port system property in any of your integration test to create a proper URL to the server.spring-doc.cn

Customize JMX Port

The jmxPort property allows to customize the port the plugin uses to communicate with the Spring Boot application.spring-doc.cn

This example shows how you can customize the port in case 9001 is already used:spring-doc.cn

<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
			<configuration>
				<jmxPort>9009</jmxPort>
			</configuration>
			<executions>
				<execution>
					<id>pre-integration-test</id>
					<goals>
						<goal>start</goal>
					</goals>
				</execution>
				<execution>
					<id>post-integration-test</id>
					<goals>
						<goal>stop</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>
If you need to configure the JMX port, make sure to do so in the global configuration as shown above so that it is shared by both goals.

Skip Integration Tests

The skip property allows to skip the execution of the Spring Boot maven plugin altogether.spring-doc.cn

This example shows how you can skip integration tests with a command-line property and still make sure that the repackage goal runs:spring-doc.cn

<project>
	<properties>
		<skip.it>false</skip.it>
	</properties>
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>pre-integration-test</id>
						<goals>
							<goal>start</goal>
						</goals>
						<configuration>
							<skip>${skip.it}</skip>
						</configuration>
					</execution>
					<execution>
						<id>post-integration-test</id>
						<goals>
							<goal>stop</goal>
						</goals>
						<configuration>
							<skip>${skip.it}</skip>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>
				<configuration>
					<skip>${skip.it}</skip>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

By default, the integration tests will run but this setup allows you to easily disable them on the command-line as follows:spring-doc.cn

$ mvn verify -Dskip.it=true
If you need to configure the JMX port, make sure to do so in the global configuration as shown above so that it is shared by both goals.