Maven Exec插件不在Windows上使用系统路径?

Dre*_*rew 9 java windows maven-2 maven

怎么能在windows中不起作用?

   <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.2</version>
    <executions>
     <execution>
      <id>deploy-dev-ssh</id>
      <phase>install</phase>
      <goals>
       <goal>exec</goal>
      </goals>
     </execution>
    </executions>
    <configuration>
     <executable>echo</executable>
     <arguments>
      <argument>hello</argument>
     </arguments>
    </configuration>
   </plugin>
Run Code Online (Sandbox Code Playgroud)

我运行时得到这个:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (do-this) on project <my_project_name>: Command execution failed. Cannot run program "echo" (in directory "<my_local_path>"): CreateProcess error=2, The system cannot find the file specified -> [Help 1]
Run Code Online (Sandbox Code Playgroud)

如何回应不在PATH?

jav*_*y79 9

这里的问题是echo是cmd.exe程序的命令,它不是Unix中的独立进程\应用程序.为了做你想做的事情,你需要使用'echo','/ C'调用cmd作为可执行文件(告诉cmd你传递了一个命令 - 在你的Windows上看到'cmd /?'命令行.)和'hello'作为参数.

像这样:

            <configuration>
                <executable>cmd</executable>
                <arguments>
                    <argument>/C</argument>
                    <argument>echo</argument>
                    <argument>hello</argument>
                </arguments>
            </configuration>
Run Code Online (Sandbox Code Playgroud)