【问题标题】:Maven exec plugin multiple executions not workingMaven exec插件多次执行不起作用
【发布时间】:2013-11-28 10:30:50
【问题描述】:

当我通过以下方式调用exec:java 目标时,我试图让 Maven exec 插件运行多个执行:

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <id>first</id>
                    <goals>
                        <goal>java</goal>
                    </goals>
                    <configuration>
                        <mainClass>com.example.First</mainClass>
                    </configuration>
                </execution>
                <execution>
                    <id>second</id>
                    <goals>
                        <goal>java</goal>
                    </goals>
                    <configuration>
                        <mainClass>com.example.Second</mainClass>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

但是,在使用 maven 3.1.1 运行 mvn exec:java 时,我收到错误消息:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project test: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or invalid -> [Help 1]

为单次执行运行exec:java 目标(不使用嵌套的executions 元素)按预期工作。

【问题讨论】:

    标签: maven maven-3


    【解决方案1】:

    在我看来,问题在于&lt;execution/&gt; 都没有与特定的&lt;phase/&gt; 绑定。尝试设置一个。

    【讨论】:

    猜你喜欢
    • 2011-11-11
    • 1970-01-01
    • 2022-01-11
    • 2017-04-13
    • 1970-01-01
    • 2012-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多