Chapter 3. Spring Boot Maven Plugin


The Spring Boot Maven Plugin provides Spring Boot support in Apache Maven. You must have Maven 3.6.3 or later to use it

The Spring Boot Maven Plugin allows you to package executable jar or war archives, run Spring Boot applications, generate build information and start your Spring Boot application prior to running integration tests.

3.1. Getting Started

To use the Spring Boot Maven Plugin, include the appropriate XML in the plugins section of your pom.xml, as shown in the following example:

<project>
	<modelVersion>4.14.0</modelVersion>
	<artifactId>getting-started</artifactId>
	<!-- ... -->
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
</project>

3.2. Using the Plugin

Maven users can inherit from the spring-boot-starter-parent project to obtain sensible defaults. The parent project provides the following features:

  • Java 17 as the default compiler level.
  • UTF-8 source encoding.
  • Compilation with -parameters.
  • A dependency management section, inherited from the spring-boot-dependencies POM, that manages the versions of common dependencies. This dependency management lets you omit <version> tags for those dependencies when used in your own POM.
  • An execution of the repackage goal with a repackage execution id.
  • A native profile that configures the build to be able to generate a Native image.
  • Sensible resource filtering.
  • Sensible plugin configuration ({url-git-commit-id-maven-plugin}[Git Commit Id Plugin], and shade).
  • Sensible resource filtering for application.properties and application.yml including profile-specific files (for example, application-dev.properties and application-dev.yml)
Note

Since the application.properties and application.yml files accept Spring style placeholders (${…​}), the Maven filtering is changed to use @..@ placeholders.

(You can override that by setting a Maven property called resource.delimiter.)

Note

The spring-boot-starter-parent sets the maven.compiler.release property, which restricts the --add-exports, --add-reads, and --patch-module options if they modify system modules. In case you need to use those options, unset maven.compiler.release:

<maven.compiler.release></maven.compiler.release>

and then configure the source and the target options instead:

<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>

3.2.1. Inheriting the Starter Parent POM

To configure your project to inherit from the spring-boot-starter-parent, set the parent as follows:

<!-- Inherit defaults from Spring Boot -->
<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>3.5.11</version>
</parent>
Note

You only need to specify the Spring Boot version number on this dependency.

If you import additional starters, you can safely omit the version number.

With that setup, you can also override individual dependencies by overriding a property in your own project. For instance, to use a different version of the SLF4J library and the Spring Data release train, you would add the following to your pom.xml:

<properties>
	<slf4j.version>2.0.17</slf4j.version>
	<spring-data-bom.version>2025.0.5</spring-data-bom.version>
</properties>

Browse the Dependency Versions Properties section in the Spring Boot reference for a complete list of dependency version properties.

Warning

Each Spring Boot release is designed and tested against a specific set of third-party dependencies. Overriding versions may cause compatibility issues and should be done with care.

3.2.2. Using Spring Boot without the Parent POM

There may be reasons for you not to inherit from the spring-boot-starter-parent POM. You may have your own corporate standard parent that you need to use or you may prefer to explicitly declare all your Maven configuration.

If you do not want to use the spring-boot-starter-parent, you can still keep the benefit of the dependency management (but not the plugin management) by using an import scoped dependency, as follows:

<dependencyManagement>
	<dependencies>
		<dependency>
			<!-- Import dependency management from Spring Boot -->
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-dependencies</artifactId>
			<version>3.5.11</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>

The preceding sample setup does not let you override individual dependencies by using properties, as explained above. To achieve the same result, you need to add entries in the dependencyManagement section of your project before the spring-boot-dependencies entry. For instance, to use a different version of the SLF4J library and the Spring Data release train, you could add the following elements to your pom.xml:

<dependencyManagement>
	<dependencies>
		<!-- Override SLF4J provided by Spring Boot -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.7.30</version>
		</dependency>
		<!-- Override Spring Data release train provided by Spring Boot -->
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-bom</artifactId>
			<version>2024.1.10</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-dependencies</artifactId>
			<version>3.5.11</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>

3.2.3. Overriding Settings on the Command Line

The plugin offers a number of user properties, starting with spring-boot, to let you customize the configuration from the command line.

For instance, you could tune the profiles to enable when running the application as follows:

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

If you want to both have a default while allowing it to be overridden on the command line, you should use a combination of a user-provided project property and MOJO configuration.

<project>
	<properties>
		<app.profiles>local,dev</app.profiles>
	</properties>
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<profiles>${app.profiles}</profiles>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

The above makes sure that local and dev are enabled by default. Now a dedicated property has been exposed, this can be overridden on the command line as well:

$ mvn spring-boot:run -Dapp.profiles=test

3.3. Goals

The Spring Boot Plugin has the following goals:

Expand
GoalDescription

spring-boot:build-image

Package an application into an OCI image using a buildpack, forking the lifecycle to make sure that package ran. This goal is suitable for command-line invocation. If you need to configure a goal execution in your build, use build-image-no-fork instead.

spring-boot:build-image-no-fork

Package an application into an OCI image using a buildpack, but without forking the lifecycle. This goal should be used when configuring a goal execution in your build. To invoke the goal on the command-line, use build-image instead.

spring-boot:build-info

Generate a build-info.properties file based on the content of the current MavenProject.

spring-boot:help

Display help information on spring-boot-maven-plugin. Call mvn spring-boot:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.

spring-boot:process-aot

Invoke the AOT engine on the application.

spring-boot:process-test-aot

Invoke the AOT engine on tests.

spring-boot:repackage

Repackage existing JAR and WAR archives so that they can be executed from the command line using java -jar. With layout=NONE can also be used simply to package a JAR with nested dependencies (and no main class, so not executable).

spring-boot:run

Run an application in place.

spring-boot:start

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-boot:stop

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

spring-boot:test-run

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.

3.4. Running your Application with Maven

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

$ mvn spring-boot:run

Application arguments can be specified using the arguments parameter.

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.

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

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

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

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

Note

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.

Sometimes it is useful to run a test variant of your application.

Use the test-run goal with many of the same features and configuration options as run for this purpose.

3.4.1. spring-boot:run

org.springframework.boot:spring-boot-maven-plugin:3.5.6

Run an application in place.

3.4.1.1. Required parameters

Expand
NameTypeDefault

classesDirectory

File

${project.build.outputDirectory}

3.4.1.2. Optional parameters

Expand
NameTypeDefault

addResources

boolean

false

additionalClasspathElements

String[]

 

arguments

String[]

 

commandlineArguments

String

 

environmentVariables

Map

 

excludeGroupIds

String

 

excludes

List

 

includes

List

 

jvmArguments

String

 

mainClass

String

 

noverify

boolean

 

optimizedLaunch

boolean

true

skip

boolean

false

systemPropertyVariables

Map

 

useTestClasspath

Boolean

false

workingDirectory

File

 

3.4.1.3. Parameter details

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

Expand

Name

addResources

Type

boolean

Default value

false

User property

spring-boot.run.addResources

Since

1.0.0

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

Expand

Name

additionalClasspathElements

Type

java.lang.String[]

Default value

 

User property

spring-boot.run.additional-classpath-elements

Since

3.2.0

3.4.1.3.3. agents

Path to agent jars.

Expand

Name

agents

Type

java.io.File[]

Default value

 

User property

spring-boot.run.agents

Since

2.2.0

3.4.1.3.4. arguments

Arguments that should be passed to the application.

Expand

Name

arguments

Type

java.lang.String[]

Default value

 

User property

 

Since

1.0.0

3.4.1.3.5. classesDirectory

Directory containing the classes and resource files that should be used to run the application.

Expand

Name

classesDirectory

Type

java.io.File

Default value

${project.build.outputDirectory}

User property

 

Since

1.0.0

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

Expand

Name

commandlineArguments

Type

java.lang.String

Default value

 

User property

spring-boot.run.arguments

Since

2.2.3

3.4.1.3.7. environmentVariables

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

Expand

Name

environmentVariables

Type

java.util.Map

Default value

 

User property

 

Since

2.1.0

3.4.1.3.8. excludeGroupIds

Comma separated list of groupId names to exclude (exact match).

Expand

Name

excludeGroupIds

Type

java.lang.String

Default value

 

User property

spring-boot.excludeGroupIds

Since

1.1.0

3.4.1.3.9. 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:classifier

Expand

Name

excludes

Type

java.util.List

Default value

 

User property

spring-boot.excludes

Since

1.1.0

3.4.1.3.10. 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:classifier

Expand

Name

includes

Type

java.util.List

Default value

 

User property

spring-boot.includes

Since

1.2.0

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

Expand

Name

jvmArguments

Type

java.lang.String

Default value

 

User property

spring-boot.run.jvmArguments

Since

1.1.0

3.4.1.3.12. mainClass

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

Expand

Name

mainClass

Type

java.lang.String

Default value

 

User property

spring-boot.run.main-class

Since

1.0.0

3.4.1.3.13. noverify

Flag to say that the agent requires -noverify.

Expand

Name

noverify

Type

boolean

Default value

 

User property

spring-boot.run.noverify

Since

1.0.0

3.4.1.3.14. optimizedLaunch

Whether the JVM’s launch should be optimized.

Expand

Name

optimizedLaunch

Type

boolean

Default value

true

User property

spring-boot.run.optimizedLaunch

Since

2.2.0

3.4.1.3.15. profiles

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

Expand

Name

profiles

Type

java.lang.String[]

Default value

 

User property

spring-boot.run.profiles

Since

1.3.0

3.4.1.3.16. skip

Skip the execution.

Expand

Name

skip

Type

boolean

Default value

false

User property

spring-boot.run.skip

Since

1.3.2

3.4.1.3.17. systemPropertyVariables

List of JVM system properties to pass to the process.

Expand

Name

systemPropertyVariables

Type

java.util.Map

Default value

 

User property

 

Since

2.1.0

3.4.1.3.18. useTestClasspath

Flag to include the test classpath when running.

Expand

Name

useTestClasspath

Type

java.lang.Boolean

Default value

false

User property

spring-boot.run.useTestClasspath

Since

1.3.0

3.4.1.3.19. workingDirectory

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

Expand

Name

workingDirectory

Type

java.io.File

Default value

 

User property

spring-boot.run.workingDirectory

Since

1.5.0

3.4.2. spring-boot:test-run

org.springframework.boot:spring-boot-maven-plugin:3.5.6

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.

3.4.2.1. Required parameters

Expand
NameTypeDefault

classesDirectory

File

${project.build.outputDirectory}

testClassesDirectory

File

${project.build.testOutputDirectory}

3.4.2.2. Optional parameters

Expand
NameTypeDefault

addResources

boolean

false

additionalClasspathElements

String[]

 

arguments

String[]

 

commandlineArguments

String

 

environmentVariables

Map

 

excludeGroupIds

String

 

excludes

List

 

includes

List

 

jvmArguments

String

 

mainClass

String

 

noverify

boolean

 

optimizedLaunch

boolean

true

profiles

String[]

 

skip

boolean

false

systemPropertyVariables

Map

 

workingDirectory

File

 

3.4.2.3. Parameter details

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

Expand

Name

addResources

Type

boolean

Default value

false

User property

spring-boot.run.addResources

Since

1.0.0

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

Expand

Name

additionalClasspathElements

Type

java.lang.String[]

Default value

 

User property

spring-boot.run.additional-classpath-elements

Since

3.2.0

3.4.2.3.3. agents

Path to agent jars.

Expand

Name

agents

Type

java.io.File[]

Default value

 

User property

spring-boot.run.agents

Since

2.2.0

3.4.2.3.4. arguments

Arguments that should be passed to the application.

Expand

Name

arguments

Type

java.lang.String[]

Default value

 

User property

 

Since

1.0.0

3.4.2.3.5. classesDirectory

Directory containing the classes and resource files that should be used to run the application.

Expand

Name

classesDirectory

Type

java.io.File

Default value

${project.build.outputDirectory}

User property

 

Since

1.0.0

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

Expand

Name

commandlineArguments

Type

java.lang.String

Default value

 

User property

spring-boot.run.arguments

Since

2.2.3

3.4.2.3.7. environmentVariables

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

Expand

Name

environmentVariables

Type

java.util.Map

Default value

 

User property

 

Since

2.1.0

3.4.2.3.8. excludeGroupIds

Comma separated list of groupId names to exclude (exact match).

Expand

Name

excludeGroupIds

Type

java.lang.String

Default value

 

User property

spring-boot.excludeGroupIds

Since

1.1.0

3.4.2.3.9. 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:classifier

Expand

Name

excludes

Type

java.util.List

Default value

 

User property

spring-boot.excludes

Since

1.1.0

3.4.2.3.10. 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:classifier

Expand

Name

includes

Type

java.util.List

Default value

 

User property

spring-boot.includes

Since

1.2.0

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

Expand

Name

jvmArguments

Type

java.lang.String

Default value

 

User property

spring-boot.run.jvmArguments

Since

1.1.0

3.4.2.3.12. mainClass

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

Expand

Name

mainClass

Type

java.lang.String

Default value

 

User property

spring-boot.run.main-class

Since

1.0.0

3.4.2.3.13. noverify

Flag to say that the agent requires -noverify.

Expand

Name

noverify

Type

boolean

Default value

 

User property

spring-boot.run.noverify

Since

1.0.0

3.4.2.3.14. optimizedLaunch

Whether the JVM’s launch should be optimized.

Expand

Name

optimizedLaunch

Type

boolean

Default value

true

User property

spring-boot.test-run.optimizedLaunch

Since

 
3.4.2.3.15. profiles

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

Expand

Name

profiles

Type

java.lang.String[]

Default value

 

User property

spring-boot.run.profiles

Since

1.3.0

3.4.2.3.16. skip

Skip the execution.

Expand

Name

skip

Type

boolean

Default value

false

User property

spring-boot.run.skip

Since

1.3.2

3.4.2.3.17. systemPropertyVariables

List of JVM system properties to pass to the process.

Expand

Name

systemPropertyVariables

Type

java.util.Map

Default value

 

User property

 

Since

2.1.0

3.4.2.3.18. testClassesDirectory

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

Expand

Name

testClassesDirectory

Type

java.io.File

Default value

${project.build.testOutputDirectory}

User property

 

Since

 
3.4.2.3.19. workingDirectory

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

Expand

Name

workingDirectory

Type

java.io.File

Default value

 

User property

spring-boot.run.workingDirectory

Since

1.5.0

3.4.3. Examples

3.4.3.1. 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:

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

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

3.4.3.2. Using System Properties

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

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

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

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

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

3.4.3.3. Using Environment Variables

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

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

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

Environment variables defined this way take precedence over existing values.

3.4.3.4. Using Application Arguments

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

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

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

3.4.3.5. Specify Active Profiles

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

The following configuration enables the local and dev profiles:

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

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

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2026 Red Hat
Back to top