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

The plugin includes a run goal which can be used to launch your application from the command line, as shown in the following example:spring-doc.cn

$ mvn spring-boot:run

Application arguments can be specified using the arguments parameter, see using application arguments for more details.spring-doc.cn

The application is executed in a forked process and setting properties on the command-line will not affect the application. If you need to specify some JVM arguments (that is for debugging purposes), you can use the jvmArguments parameter, see Debug the application for more details. There is also explicit support for system properties and environment variables.spring-doc.cn

As enabling a profile is quite common, there is dedicated profiles property that offers a shortcut for -Dspring-boot.run.jvmArguments="-Dspring.profiles.active=dev", see Specify active profiles.spring-doc.cn

Spring Boot devtools is a module to improve the development-time experience when working on Spring Boot applications. To enable it, just add the following dependency to your project:spring-doc.cn

<dependencies>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-devtools</artifactId>
		<optional>true</optional>
	</dependency>
</dependencies>

When devtools is running, it detects changes when you recompile your application and automatically refreshes it. This works for not only resources but code as well. It also provides a LiveReload server so that it can automatically trigger a browser refresh whenever things change.spring-doc.cn

Devtools can also be configured to only refresh the browser whenever a static resource has changed (and ignore any change in the code). Just include the following property in your project:spring-doc.cn

spring.devtools.remote.restart.enabled=false

Prior to devtools, the plugin supported hot refreshing of resources by default which has now been disabled in favour of the solution described above. You can restore it at any time by configuring your project:spring-doc.cn

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<addResources>true</addResources>
				</configuration>
			</plugin>
		</plugins>
	</build>

When addResources is enabled, any src/main/resources directory will be added to the application classpath when you run the application and any duplicate found in the classes output will be removed. This allows hot refreshing of resources which can be very useful when developing web applications. For example, you can work on HTML, CSS or JavaScript files and see your changes immediately without recompiling your application. It is also a helpful way of allowing your front end developers to work without needing to download and install a Java IDE.spring-doc.cn

A side effect of using this feature is that filtering of resources at build time will not work.

In order to be consistent with the repackage goal, the run goal builds the classpath in such a way that any dependency that is excluded in the plugin’s configuration gets excluded from the classpath as well. For more details, see the dedicated example.spring-doc.cn

Sometimes it is useful to run a test variant of your application. For example, if you want to use Testcontainers at development time or make use of some test stubs. Use the test-run goal with many of the same features and configuration options as run for this purpose.spring-doc.cn

A side effect of using this feature is that filtering of resources at build time will not work.

spring-boot:run

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

Run an application in place.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

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

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

optimizedLaunch

Whether the JVM’s launch should be optimized.spring-doc.cn

Namespring-doc.cn

optimizedLaunchspring-doc.cn

Typespring-doc.cn

booleanspring-doc.cn

Default valuespring-doc.cn

truespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.optimizedLaunchspring-doc.cn

Sincespring-doc.cn

2.2.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

1.3.0spring-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

jvmArgumentsspring-doc.cn

Stringspring-doc.cn

mainClassspring-doc.cn

Stringspring-doc.cn

noverifyspring-doc.cn

booleanspring-doc.cn

optimizedLaunchspring-doc.cn

booleanspring-doc.cn

truespring-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

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

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

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

optimizedLaunchspring-doc.cn

Typespring-doc.cn

booleanspring-doc.cn

Default valuespring-doc.cn

truespring-doc.cn

User propertyspring-doc.cn

spring-boot.run.optimizedLaunchspring-doc.cn

Sincespring-doc.cn

2.2.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

1.3.0spring-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:test-run

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

Run an application in place using the test runtime classpath. The main class that will be used to launch the application is determined as follows: The configured main class, if any. Then the main class found in the test classes directory, if any. Then the main class found in the classes directory, if any.spring-doc.cn

Required parameters

Name Type Default

classesDirectoryspring-doc.cn

Filespring-doc.cn

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

testClassesDirectoryspring-doc.cn

Filespring-doc.cn

${project.build.testOutputDirectory}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

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

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

optimizedLaunch

Whether the JVM’s launch should be optimized.spring-doc.cn

Namespring-doc.cn

optimizedLaunchspring-doc.cn

Typespring-doc.cn

booleanspring-doc.cn

Default valuespring-doc.cn

truespring-doc.cn

User propertyspring-doc.cn

spring-boot.test-run.optimizedLaunchspring-doc.cn

Sincespring-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

testClassesDirectory

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

Namespring-doc.cn

testClassesDirectoryspring-doc.cn

Typespring-doc.cn

java.io.Filespring-doc.cn

Default valuespring-doc.cn

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

User propertyspring-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

testClassesDirectoryspring-doc.cn

Filespring-doc.cn

${project.build.testOutputDirectory}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

jvmArgumentsspring-doc.cn

Stringspring-doc.cn

mainClassspring-doc.cn

Stringspring-doc.cn

noverifyspring-doc.cn

booleanspring-doc.cn

optimizedLaunchspring-doc.cn

booleanspring-doc.cn

truespring-doc.cn

profilesspring-doc.cn

String[]spring-doc.cn

skipspring-doc.cn

booleanspring-doc.cn

falsespring-doc.cn

systemPropertyVariablesspring-doc.cn

Mapspring-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

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

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

optimizedLaunchspring-doc.cn

Typespring-doc.cn

booleanspring-doc.cn

Default valuespring-doc.cn

truespring-doc.cn

User propertyspring-doc.cn

spring-boot.test-run.optimizedLaunchspring-doc.cn

Sincespring-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

testClassesDirectoryspring-doc.cn

Typespring-doc.cn

java.io.Filespring-doc.cn

Default valuespring-doc.cn

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

User propertyspring-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

Examples

Debug the Application

The run and test-run goals run your application in a forked process. If you need to debug it, you should add the necessary JVM arguments to enable remote debugging. The following configuration suspend the process until a debugger has joined on port 5005:spring-doc.cn

<project>
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<jvmArguments>
						-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005
					</jvmArguments>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

These arguments can be specified on the command line as well:spring-doc.cn

$ mvn spring-boot:run -Dspring-boot.run.jvmArguments=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005

Using System Properties

System properties can be specified using the systemPropertyVariables attribute. The following example sets property1 to test and property2 to 42:spring-doc.cn

<project>
	<build>
		<properties>
			<my.value>42</my.value>
		</properties>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<systemPropertyVariables>
						<property1>test</property1>
						<property2>${my.value}</property2>
					</systemPropertyVariables>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

If the value is empty or not defined (that is <my-property/>), the system property is set with an empty String as the value. Maven trims values specified in the pom, so it is not possible to specify a System property which needs to start or end with a space through this mechanism: consider using jvmArguments instead.spring-doc.cn

Any String typed Maven variable can be passed as system properties. Any attempt to pass any other Maven variable type (for example a List or a URL variable) will cause the variable expression to be passed literally (unevaluated).spring-doc.cn

The jvmArguments parameter takes precedence over system properties defined with the mechanism above. In the following example, the value for property1 is overridden:spring-doc.cn

$ mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dproperty1=overridden"

Using Environment Variables

Environment variables can be specified using the environmentVariables attribute. The following example sets the 'ENV1', 'ENV2', 'ENV3', 'ENV4' env variables:spring-doc.cn

<project>
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<environmentVariables>
						<ENV1>5000</ENV1>
						<ENV2>Some Text</ENV2>
						<ENV3/>
						<ENV4></ENV4>
					</environmentVariables>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

If the value is empty or not defined (that is <MY_ENV/>), the env variable is set with an empty String as the value. Maven trims values specified in the pom so it is not possible to specify an env variable which needs to start or end with a space.spring-doc.cn

Any String typed Maven variable can be passed as system properties. Any attempt to pass any other Maven variable type (for example a List or a URL variable) will cause the variable expression to be passed literally (unevaluated).spring-doc.cn

Environment variables defined this way take precedence over existing values.spring-doc.cn

Using Application Arguments

Application arguments can be specified using the arguments attribute. The following example sets two arguments: property1 and property2=42:spring-doc.cn

<project>
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<arguments>
						<argument>property1</argument>
						<argument>property2=${my.value}</argument>
					</arguments>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

On the command-line, arguments are separated by a space the same way jvmArguments are. If an argument contains a space, make sure to quote it. In the following example, two arguments are available: property1 and property2=Hello World:spring-doc.cn

$ mvn spring-boot:run -Dspring-boot.run.arguments="property1 'property2=Hello World'"

Specify Active Profiles

The active profiles to use for a particular application can be specified using the profiles argument.spring-doc.cn

The following configuration enables the local and dev profiles:spring-doc.cn

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

The profiles to enable can be specified on the command line as well, make sure to separate them with a comma, as shown in the following example:spring-doc.cn

$ mvn spring-boot:run -Dspring-boot.run.profiles=local,dev