Maven - exec-maven-plugin - CreateProcess error=2, 系统找不到指定的文件

Maven - exec-maven-plugin - CreateProcess error=2, The system cannot find the file specified

我正在使用此代码在 Install 阶段后立即将 JAR 文件上传到服务器:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>3.0.0</version>
    <executions>
      <execution>
        <id>server-deployment</id>
        <phase>install</phase>
        <goals>
          <goal>exec</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <executable>D:\my-folder\pscp.exe -r -i D:\my-folder-conf\user.ppk D:\my-folder-jar\file-1.1.0.jar ubuntu@X.XX.XX.XXX:/usr/local/folder1/jar/file-1.1.0.jar</executable>
    </configuration>
  </plugin>

命令:

D:\my-folder\pscp.exe -r -i D:\my-folder-conf\user.ppk D:\my-folder-jar\file-1.1.0.jar ubuntu@X.XX.XX.XXX:/usr/local/folder1/jar/file-1.1.0.jar

Windows Console 正常工作并且文件已上传,但是当我使用 exec-maven-plugin 执行完全相同的命令时,它失败并显示消息:CreateProcess error=2, The system cannot find the file specified。如果我提供所有文件的完整路径和扩展名,这是如何发生的?这个有什么解决办法吗=

解法:

我最终使用了@xerx593的方法,感谢您的帮助,下面是最终的解决方案:

<configuration>
  <executable>D:\my-folder\pscp.exe</executable>
  <arguments>
    <argument>-r</argument>        
    <argument>-i</argument>      
    <argument>D:\my-folder-conf\user.ppk</argument>       
    <argument>${project.build.directory}/${project.build.finalName}.jar</argument> 
    <argument>ubuntu@X.XX.XX.XXX:/usr/local/folder1/jar/${project.build.finalName}.jar</argument>  
  </arguments>
</configuration>

请尝试:

    <configuration>
      <executable>D:\my-folder\pscp.exe</executable>
      <arguments>
        <argument>-r</argument>        
        <argument>-i</argument>      
        <argument>D:\my-folder-conf\user.ppk</argument>       
        <argument>D:\my-folder-jar\file-1.1.0.jar</argument> 
        <argument>ubuntu@X.XX.XX.XXX:/usr/local/folder1/jar/file-1.1.0.jar</argument>  
      </arguments>
    </configuration>

...改为 documented (& shown)。