我正在使用此代碼JAR在Install階段之后將檔案上傳到服務器:
<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 [email protected]:/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 [email protected]:/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>[email protected]:/usr/local/folder1/jar/${project.build.finalName}.jar</argument>
</arguments>
</configuration>
uj5u.com熱心網友回復:
請試試:
<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>[email protected]:/usr/local/folder1/jar/file-1.1.0.jar</argument>
</arguments>
</configuration>
...作為記錄(&顯示)代替。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/405478.html
標籤:
