views:

32

answers:

1

How can this not work in 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>

I get this when I run it:

[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]

How can echo not be on the PATH?

+2  A: 

The problem here is that echo is a command of the cmd.exe program, it is not a standalone process\application as in Unix. In order to do what you are trying to do here you need to call cmd as the executable with 'echo', '/C' (to tell cmd that you're passing it a command - see 'cmd /?' on your Windows command line.) and 'hello' as arguments.

Like so:

            <configuration>
                <executable>cmd</executable>
                <arguments>
                    <argument>/C</argument>
                    <argument>echo</argument>
                    <argument>hello</argument>
                </arguments>
            </configuration>
javamonkey79