[[run.test-run-goal]]
= `spring-boot:test-run`

`org.springframework.boot:spring-boot-maven-plugin:3.3.0-SNAPSHOT`

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.



[[run.test-run-goal.required-parameters]]
== Required parameters

[cols="3,2,3"]
|===
| Name | Type | Default

| xref:#run.test-run-goal.parameter-details.classes-directory[classesDirectory]
| `File`
| `${project.build.outputDirectory}`

| xref:#run.test-run-goal.parameter-details.test-classes-directory[testClassesDirectory]
| `File`
| `${project.build.testOutputDirectory}`

|===



[[run.test-run-goal.optional-parameters]]
== Optional parameters

[cols="3,2,3"]
|===
| Name | Type | Default

| xref:#run.test-run-goal.parameter-details.add-resources[addResources]
| `boolean`
| `false`

| xref:#run.test-run-goal.parameter-details.additional-classpath-elements[additionalClasspathElements]
| `String[]`
|

| xref:#run.test-run-goal.parameter-details.agents[agents]
| `File[]`
|

| xref:#run.test-run-goal.parameter-details.arguments[arguments]
| `String[]`
|

| xref:#run.test-run-goal.parameter-details.commandline-arguments[commandlineArguments]
| `String`
|

| xref:#run.test-run-goal.parameter-details.directories[directories]
| `String[]`
|

| xref:#run.test-run-goal.parameter-details.environment-variables[environmentVariables]
| `Map`
|

| xref:#run.test-run-goal.parameter-details.exclude-group-ids[excludeGroupIds]
| `String`
|

| xref:#run.test-run-goal.parameter-details.excludes[excludes]
| `List`
|

| xref:#run.test-run-goal.parameter-details.includes[includes]
| `List`
|

| xref:#run.test-run-goal.parameter-details.jvm-arguments[jvmArguments]
| `String`
|

| xref:#run.test-run-goal.parameter-details.main-class[mainClass]
| `String`
|

| xref:#run.test-run-goal.parameter-details.noverify[noverify]
| `boolean`
|

| xref:#run.test-run-goal.parameter-details.optimized-launch[optimizedLaunch]
| `boolean`
| `true`

| xref:#run.test-run-goal.parameter-details.profiles[profiles]
| `String[]`
|

| xref:#run.test-run-goal.parameter-details.skip[skip]
| `boolean`
| `false`

| xref:#run.test-run-goal.parameter-details.system-property-variables[systemPropertyVariables]
| `Map`
|

| xref:#run.test-run-goal.parameter-details.working-directory[workingDirectory]
| `File`
|

|===



[[run.test-run-goal.parameter-details]]
== Parameter details



[[run.test-run-goal.parameter-details.add-resources]]
=== `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.

[cols="10h,90"]
|===

| Name
| `addResources`

| Type
| `boolean`

| Default value
| `false`

| User property
| ``spring-boot.run.addResources``

| Since
| `1.0.0`

|===


[[run.test-run-goal.parameter-details.additional-classpath-elements]]
=== `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.

[cols="10h,90"]
|===

| Name
| `additionalClasspathElements`

| Type
| `java.lang.String[]`

| Default value
|

| User property
| ``spring-boot.run.additional-classpath-elements``

| Since
| `3.2.0`

|===


[[run.test-run-goal.parameter-details.agents]]
=== `agents`
Path to agent jars.

[cols="10h,90"]
|===

| Name
| `agents`

| Type
| `java.io.File[]`

| Default value
|

| User property
| ``spring-boot.run.agents``

| Since
| `2.2.0`

|===


[[run.test-run-goal.parameter-details.arguments]]
=== `arguments`
Arguments that should be passed to the application.

[cols="10h,90"]
|===

| Name
| `arguments`

| Type
| `java.lang.String[]`

| Default value
|

| User property
|

| Since
| `1.0.0`

|===


[[run.test-run-goal.parameter-details.classes-directory]]
=== `classesDirectory`
Directory containing the classes and resource files that should be used to run the application.

[cols="10h,90"]
|===

| Name
| `classesDirectory`

| Type
| `java.io.File`

| Default value
| `${project.build.outputDirectory}`

| User property
|

| Since
| `1.0.0`

|===


[[run.test-run-goal.parameter-details.commandline-arguments]]
=== `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`.

[cols="10h,90"]
|===

| Name
| `commandlineArguments`

| Type
| `java.lang.String`

| Default value
|

| User property
| ``spring-boot.run.arguments``

| Since
| `2.2.3`

|===


[[run.test-run-goal.parameter-details.directories]]
=== `directories`
Additional directories containing classes or resources that should be added to the classpath.

[cols="10h,90"]
|===

| Name
| `directories`

| Type
| `java.lang.String[]`

| Default value
|

| User property
| ``spring-boot.run.directories``

| Since
| `1.0.0`

|===


[[run.test-run-goal.parameter-details.environment-variables]]
=== `environmentVariables`
List of Environment variables that should be associated with the forked process used to run the application.

[cols="10h,90"]
|===

| Name
| `environmentVariables`

| Type
| `java.util.Map`

| Default value
|

| User property
|

| Since
| `2.1.0`

|===


[[run.test-run-goal.parameter-details.exclude-group-ids]]
=== `excludeGroupIds`
Comma separated list of groupId names to exclude (exact match).

[cols="10h,90"]
|===

| Name
| `excludeGroupIds`

| Type
| `java.lang.String`

| Default value
|

| User property
| ``spring-boot.excludeGroupIds``

| Since
| `1.1.0`

|===


[[run.test-run-goal.parameter-details.excludes]]
=== `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`

[cols="10h,90"]
|===

| Name
| `excludes`

| Type
| `java.util.List`

| Default value
|

| User property
| ``spring-boot.excludes``

| Since
| `1.1.0`

|===


[[run.test-run-goal.parameter-details.includes]]
=== `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`

[cols="10h,90"]
|===

| Name
| `includes`

| Type
| `java.util.List`

| Default value
|

| User property
| ``spring-boot.includes``

| Since
| `1.2.0`

|===


[[run.test-run-goal.parameter-details.jvm-arguments]]
=== `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.

[cols="10h,90"]
|===

| Name
| `jvmArguments`

| Type
| `java.lang.String`

| Default value
|

| User property
| ``spring-boot.run.jvmArguments``

| Since
| `1.1.0`

|===


[[run.test-run-goal.parameter-details.main-class]]
=== `mainClass`
The name of the main class. If not specified the first compiled class found that contains a 'main' method will be used.

[cols="10h,90"]
|===

| Name
| `mainClass`

| Type
| `java.lang.String`

| Default value
|

| User property
| ``spring-boot.run.main-class``

| Since
| `1.0.0`

|===


[[run.test-run-goal.parameter-details.noverify]]
=== `noverify`
Flag to say that the agent requires -noverify.

[cols="10h,90"]
|===

| Name
| `noverify`

| Type
| `boolean`

| Default value
|

| User property
| ``spring-boot.run.noverify``

| Since
| `1.0.0`

|===


[[run.test-run-goal.parameter-details.optimized-launch]]
=== `optimizedLaunch`
Whether the JVM's launch should be optimized.

[cols="10h,90"]
|===

| Name
| `optimizedLaunch`

| Type
| `boolean`

| Default value
| `true`

| User property
| ``spring-boot.test-run.optimizedLaunch``

| Since
|

|===


[[run.test-run-goal.parameter-details.profiles]]
=== `profiles`
The spring profiles to activate. Convenience shortcut of specifying the 'spring.profiles.active' argument. On command line use commas to separate multiple profiles.

[cols="10h,90"]
|===

| Name
| `profiles`

| Type
| `java.lang.String[]`

| Default value
|

| User property
| ``spring-boot.run.profiles``

| Since
| `1.3.0`

|===


[[run.test-run-goal.parameter-details.skip]]
=== `skip`
Skip the execution.

[cols="10h,90"]
|===

| Name
| `skip`

| Type
| `boolean`

| Default value
| `false`

| User property
| ``spring-boot.run.skip``

| Since
| `1.3.2`

|===


[[run.test-run-goal.parameter-details.system-property-variables]]
=== `systemPropertyVariables`
List of JVM system properties to pass to the process.

[cols="10h,90"]
|===

| Name
| `systemPropertyVariables`

| Type
| `java.util.Map`

| Default value
|

| User property
|

| Since
| `2.1.0`

|===


[[run.test-run-goal.parameter-details.test-classes-directory]]
=== `testClassesDirectory`
Directory containing the test classes and resource files that should be used to run the application.

[cols="10h,90"]
|===

| Name
| `testClassesDirectory`

| Type
| `java.io.File`

| Default value
| `${project.build.testOutputDirectory}`

| User property
|

| Since
|

|===


[[run.test-run-goal.parameter-details.working-directory]]
=== `workingDirectory`
Current working directory to use for the application. If not specified, basedir will be used.

[cols="10h,90"]
|===

| Name
| `workingDirectory`

| Type
| `java.io.File`

| Default value
|

| User property
| ``spring-boot.run.workingDirectory``

| Since
| `1.5.0`

|===
