1. 程式人生 > >Cannot run program "git" (in directory "目錄"): error=2, No such file or directory

Cannot run program "git" (in directory "目錄"): error=2, No such file or directory

Jenkins下對工程進行編譯報出錯誤:java.io.IOException: Cannot run program "java" (in directory "目錄"): error=2, No such file or directory,我遇到的這種情況是由於環境變數設定引起的,由於伺服器重啟後啟動Jenkins未對其進行環境變數重新引導造成。需要在Jenkins中加入指令碼:

pwd
source ~/.bash_profile
source /etc/profile

加入指令碼後問題解決!