Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.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:exec`失败,但`exec:java`成功_Maven_Maven 3_Maven Plugin - Fatal编程技术网

maven`exec:exec`失败,但`exec:java`成功

maven`exec:exec`失败,但`exec:java`成功,maven,maven-3,maven-plugin,Maven,Maven 3,Maven Plugin,我了解到,执行有两个目标,exec:exec和exec:java,但我不知道如何指定它们: 在我的例子中,mvn exec:java运行良好,但是mvn exec:exec不断抛出异常,如下所示: [信息]---execmaven插件:1.6.0:exec(run)@allnewmaker--- [错误]命令执行失败。 java.io.IOException:无法运行程序“exec”(目录“/home/huang/Desktop/Project/Make/allnewmaker”):错误=2,

我了解到,执行有两个目标,
exec:exec
exec:java
,但我不知道如何指定它们:

在我的例子中,
mvn exec:java
运行良好,但是
mvn exec:exec
不断抛出异常,如下所示:


[信息]---execmaven插件:1.6.0:exec(run)@allnewmaker---
[错误]命令执行失败。
java.io.IOException:无法运行程序“exec”(目录“/home/huang/Desktop/Project/Make/allnewmaker”):错误=2,没有这样的文件或目录
位于java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
位于java.lang.Runtime.exec(Runtime.java:620)
位于org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:61)
位于org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:279)
位于org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:336)
位于org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
位于org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:804)
位于org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:751)

我的
pom.xml
如下所示:

    <plugins>
        <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>bar</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>foo</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!--default: java-->
                    <executable>exec</executable>
                    <arguments>
                        <argument>-i</argument>
                        <argument>${argInput}</argument>
                        <argument>-o</argument>
                        <argument>${argOutput}</argument>
                    </arguments>
                    <mainClass>org.qoros.maker.AllNewMaker</mainClass>
                </configuration>
            </plugin>
        </plugins>

org.codehaus.mojo
execmaven插件
酒吧
执行官
福
执行官
执行官
-我
${PUT}
-o
${argOutput}
org.qoros.maker.AllNewMaker

在pom中,您有可执行文件的名称: 执行官 并且名称“exec”不是有效的可执行文件名称

您可以在此处配置您的目标:

<execution>
    <id>bar</id>
    <goals>
        <goal>exec</goal>
    </goals>
</execution>

酒吧
执行官
如果您想使用exec:java,您需要将目标从exec更改为java

我指的是使用页面:


如果需要澄清,请告诉我

你应该在你的日志中有它:[INFO]--exec-maven-plugin:1.6.0:exec(run)@allnewmaker--其中exec-maven-plugin:1.6.0:GOALIt在我使用“-X”选项时可见