Run/Debug Configuration: Maven
You can run Maven goals using run configuration. The default options listed in such a configuration are enough to run your task. If you want, you can also create an advanced configuration using additional options or adding more goals and arguments.
Create a run/debug Maven configuration
From the main menu, select Add Configuration. Alternatively, right-click any task in the Maven tool window and select Modify Run Configuration.
Specify a name of your configuration in the Name field to quickly identify it when editing or running the configuration, for example, from the Run popup Alt+Shift+F10 or the Maven tool window.
Specify where you want your configuration to run on. The default Local Machine option will run your configuration locally on your computer.
You can change the location of your run execution. For example, use SSH or Docker to run your target.
You can also run your target on WSL. If you need to configure a new target or change the existing configuration, click Manage targets and in the Run Targets dialog, add your changes. For more information, refer to Run targets.
If you need, specify Store as project file that saves the file with the run configuration settings, so you can share it with other team members. The default location is .idea/runConfigurations. However, if you do not want to share the .idea directory, you can save the configuration to any other directory within the project.
To change the location, select this option and click and in the dialog that opens, add the new location.
Specify which Maven version should be used to execute the run configuration.
Use this list to select a bundled Maven version that is available (for Maven2, version 2.2.1 and for Maven3, version 3.1), the result of resolved system variables such as
MAVEN_HOME
orMAVEN2_HOME
, or the Maven wrapper. You can also specify your own Maven version that is installed on your machine. You can click and select the necessary directory in the dialog that opens.You must specify a valid cycle phase or a goal in the Run field to have an executable run configuration. Alternatively, if you are creating a run configuration from the Maven tool window, the goal you have selected will be displayed in this field. However, you can specify additional external goals and arguments for your run configuration. Use spaces to separate one goal from another. If you want to see the available list of Maven goals and arguments, click in the field.
Specify the location of your Maven project.
You can either enter it manually or click and point to the desired location in the dialog that opens. However, if you are creating a run configuration from the Maven tool window, IntelliJ IDEA will display the name of your project automatically.
If you need, you can specify a path to the build script file instead of the project path. This might be helpful if you have a custom build script to which you want to refer.
Specify profiles if you have them declared in your project. For more information about Maven profiles, see Maven profiles.
If you need, specify the environment variables that you want to use in you project.
The following default options are enabled, but you can click Modify options to add new options or remove some of the default ones in Add Run Options:
Open run/debug tool window when started - automatically opens the Run/Debug tool window when the configuration is executed and several debugger options
Maven Options - lists the default Maven options inherited from the Maven settings. If you want to change them, unselect the Inherit from settings option or click Modify to add new Maven options.
Java Options - lists the default Java options inherited from the Maven settings. If you want to change them, unselect the Inherit from settings option or click Modify to add new Maven options.
Modify run options
Click Modify options to add more run options or remove some of the default ones described above.
Item | Description |
---|---|
Allow multiple instances | Select this option to allow running multiple instances of this run configuration in parallel. By default, it is disabled, and when you start this configuration while another instance is still running, IntelliJ IDEA suggests stopping the running instance and starting another one. This is helpful when a run configuration consumes a lot of resources and there is no good reason to run multiple instances. |
Item | Description |
---|---|
VM options | Specify the options to be passed to the Java virtual machine when launching the application, for example, When specifying JVM options, follow these rules:
-Xmx1024m -Dspaces="some arg" -Dmy.prop=\"quoted_value\" -Dfoo=${MY_ENV_VAR}
Use code completion in this field: start typing the name of a flag, and the IDE suggests a list of available command line options. This works for The |
JRE | Specify a version of Java to use in your run configuration. |
Item | Description |
---|---|
Profiles | Specify the profiles to be used separated with space. |
User settings | Specify the file that contains user-specific configuration for Maven in the text field. If you need to specify another file, check the Override option, click the ellipsis button and select the desired file in the Select Maven Settings File dialog. |
Local repository | By default, the field shows the path to the local directory under the user home that stores the downloads and contains the temporary build artifacts that you have not yet released. If you need to specify another directory, check the Override option, click the ellipsis button and select the desired path in the Select Maven Local Repository dialog. |
Thread Count | Use this field to set the For more information, refer to parallel builds in Maven 3 feature. |
Skip Tests | If this option is checked, the tests will be skipped when running or debugging the Maven project. |
Use plugin registry | Check this option to enable referring to the Maven Plugin Registry. This option corresponds to the |
Print exception stacktraces | If this option is checked, exception stack traces are generated. This option corresponds to the |
Always update snapshots | Select this checkbox to always update snapshot dependencies. |
Resolve Workspace artifacts | We recommend that you use this checkbox if you have dependent modules in your project. By default, this checkbox is not selected. In this case, classes of dependent modules are searched in .jar files in a Maven local repository. If you select this checkbox, the classes of the dependent modules will be searched in the module compilation output. In this case, each time you make changes to the dependent module, you don't need to deploy them into a local repository. |
Executed goals recursively | If this option is cleared, the build does not recur into the nested projects. Clearing this option equals to |
Work offline | f this option is checked, Maven works in the offline mode and uses only those resources that are available locally. This option corresponds to the |
Checksum policy | Select the desired level of checksum matching while downloading artifacts. You can opt to fail downloading when checksums do not match |
Output level | Select the desired level of the output log, which allows plugins to create messages at levels of debug, info, warn, and error, or disable output log. |
Multiproject build fail policy | Specify how to treat a failure in a multiproject build. You can choose to:
|
You can select which log files that are generated while running or debugging should be displayed in the console, that is, on the dedicated tabs of the Run or Debug tool window. You can also select an option that saves the console output to a file or show the console output when a message is printed to |
You can select additional options to add before the run configuration is executed. For example, you can add a Maven goal or an argument that you want to execute before you run your configuration. Click Add before launch task and in the list that opens, select Run Maven Goal, and in the dialog that opens configure your task. |