更改 NetBeans Maven Java 项目的 exec-maven-plugin 版本

Change exec-maven-plugin Version for NetBeans Maven Java Project

当我在 NetBeans 中 运行 一个 Java Maven 项目时,Maven 首先执行以下插件:

--- exec-maven-plugin:1.2.1:exec (default-cli) @ Questionnaire ---

如何更改执行的插件版本?相反,我想使用版本 1.1.1.

我已经尝试在 pom 的 <build> 部分指定版本,如下所示,但无济于事。

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.sample</groupId>
    <artifactId>My Project</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.34</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.2.1.Final</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.1.1</version>
            </plugin>
        </plugins>
    </build>
</project>

我发现我可以在运行配置。

最好是在 pom 文件的 pluginManagement 部分定义适当插件的版本,而不是在 IDE.

<project>
  ...
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>1.3.2</version>
        </plugin>
        ...
      </plugins>
    </pluginManagement>
    ..
  </build>
   ..
</project>