2017-06-27 45 views
0

我想將PHP文件轉換爲服務器使用gradle。我試着用下面的腳本,但我不知道如何傳遞用戶名和密碼Scp Php文件到服務器使用gradle

plugins { 
    id 'org.hidetake.ssh' version 'x.y.z' 
} 

remotes { 
    webServer { 
    host = '192.168.1.101' 
    user = 'jenkins' 
    identity = file('id_rsa') 
    } 
} 

task deploy { 
    doLast { 
    ssh.run { 
     session(remotes.webServer) { 
     put from: 'example.war', into: '/webapps' 
     } 
    } 
    } 
} 

回答

0

嘗試這樣

plugins { 
    id 'org.hidetake.ssh' version '2.9.0' 
} 
ssh.settings { 
knownHosts = allowAnyHosts 
} 
remotes { 
    webServer { 
    host = 'ip' 
    user = 'username' 
    password='password' 
    } 
} 

task deploy { 
    doLast { 
    ssh.run { 
     session(remotes.webServer) { 
     put from: 'src', into: '/home/Desktop/Gradle' 

     } 
    } 
    } 
+0

感謝您的工作正常 – kishor

相關問題