Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有Maven Exec插件的多个命令_Maven_Build Management_Maven Exec Plugin - Fatal编程技术网

带有Maven Exec插件的多个命令

带有Maven Exec插件的多个命令,maven,build-management,maven-exec-plugin,Maven,Build Management,Maven Exec Plugin,我对Maven Exec插件有点纠结。我想使用插件执行两个独立的mvn命令,因此我只需要执行mvn exec:exec即可执行所有命令 以下两个命令分别运行良好: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.6.0</version>

我对Maven Exec插件有点纠结。我想使用插件执行两个独立的mvn命令,因此我只需要执行mvn exec:exec即可执行所有命令

以下两个命令分别运行良好:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.6.0</version>
    <configuration>
        <executable>mvn</executable>
        <arguments>
            <argument>clean</argument>
        </arguments>
    </configuration>
</plugin>

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.6.0</version>
    <configuration>
        <executable>mvn</executable>
        <arguments>
            <argument>package</argument>
        </arguments>
    </configuration>
</plugin>

当您在命令行上运行
mvn exec:exec
时,它运行
,其中
默认cli
。这解释了错误消息,因为在POM中没有配置了
默认cli执行

要解决您的问题,请查看。它解释了如何使用
而不是
默认cli从命令行执行目标:

mvn exec:exec@id1 exec:exec@id2

当您在命令行上运行
mvn exec:exec
时,它运行
,其中
默认cli
。这解释了错误消息,因为在POM中没有配置了
默认cli执行

要解决您的问题,请查看。它解释了如何使用
而不是
默认cli从命令行执行目标:

mvn exec:exec@id1 exec:exec@id2

当我现在执行mvn exec:exec时
=>您应该在将2次执行绑定到该阶段时运行“package”。
当我现在执行mvn exec:exec时
=>您应该在将2次执行绑定到该阶段时运行“package”。
mvn exec:exec@id1 exec:exec@id2