# 配置 Maven 目标

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com.cn/help/idea/llms.txt).

> **TL;DR**
> 性能分析器主页：  `查看 | 工具窗口 | Profiler`

在 IntelliJ IDEA，您可以分析几个目标：

* [Maven Failsafe Plugin](https://maven.apache.org/surefire/maven-failsafe-plugin/)： `failsafe:integration-test`

* [Maven Surefire Plugin](https://maven.apache.org/surefire/maven-surefire-plugin/)： `surefire:test`

* [Exec Maven Plugin](https://www.mojohaus.org/exec-maven-plugin/)： `exec:exec` 和 `exec:java` 请确保为 `mainClass` 指定参数给 `exec:java` 。 您可以在您的 `pom.xml` 中或在相应运行/调试配置中的 命令行 字段中执行此操作。 如需更多信息，请参阅 [Exec Maven Plugin 文档](https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#mainClass)。

Procedure:

1. 在主菜单中，前往  `视图 | 工具窗口 | Maven` 。

2. 在   Maven  工具窗口中，右键点击您要分析的目标，然后选择   使用 IntelliJ Profiler 进行分析  。

IntelliJ IDEA 创建一个临时的 [运行配置](run-debug-configuration.html)，您可以 [保存](run-debug-configuration.html#save-as-permanent)并稍后重新运行。

如果您已经有了所需目标的 Maven 运行/调试配置，您可以 [以相同的方式为其分析性能](create-a-profiling-report.html#start-with-profiler)，就像其他运行配置一样。

## 限制

目前，分析 Maven 目标存在一些限制：

* IntelliJ IDEA 中的分析工具不支持 Maven 配置、执行和版本。 这就是为什么某些复杂配置可能无法正确分析。

* 不支持对上述目标的特定版本进行分析（例如： `org.codehaus.mojo:exec-maven-plugin:3.0.0:exec` ）。

* 如果目标在配置时会在执行过程中创建多个进程，则无法分析目标。

* 仅在没有模块的项目中才能进行 `exec:exec` 、 `surefire:test` 和 `failsafe:integration-test` 目标的分析。 然而，您可以分析一个特定的模块，只要它没有子模块。

* 如果插件配置中包含某些参数，则无法进行分析： * `commandlineArgs` 在 `exec:exec` 插件配置中 * `debugForkedProcess` 在 `surefire:test` 和 `failsafe:integration-test` 插件配置中

* 如果 Exec Maven Plugin 配置在 `<arguments>` 中的 `pom.xml` ，则在执行 `exec:exec` 目标期间会跳过 `<arguments>` 中的值。

