1. connection failure caused by port problems
Remote-Prepare: [sshexec] connecting to 123.123.123.123: 22java.net. connectexception: Connection timed out
Solution
Modify build. xml and configure the port number.
<Target name = "remote-prepare"> <sshexec host = "$ {web. host} "username =" $ {web. host. user} "Port =" 2014 "Password =" $ {web. host. PWD} "command =" mkdir-p $ {web. host. webroot }/.. /builds "Trust =" true "/> </Target>
2. No permission is displayed
Com. jcraft. jsch. jschexception: AUTH fail
Cause: for the sake of security, the server connection uses the key file instead of the user name and password, so you need to replace password with Keyfile.
<Target name = "remote-prepare"> <sshexec host = "$ {web. host} "username =" $ {web. host. user} "Port =" 2014 "Keyfile =" $ {web. host. PWD} "command =" mkdir-p $ {web. host. webroot }/.. /builds "Trust =" true "/> </Target>
To modify the port number and Keyfile label, remember to change all the places used to avoid omission.
3. No Password or phrase is provided
Neither password nor passphrase for user root has been given. Can't authenticate.
Add passphrase
<Target name = "Upload" depends = "package" Unless = "noup"> <fail unless = "Web. host. webroot "message =" Please specify $ {web. host. webroot }. eg,-dwebroot. dir =/var/www/htdocs/"/> <antcall target =" remote-prepare "/> <echo> uploading build tar file to $ {web. host. webroot }/.. /builds </echo> <echo> This will take a few minutes... </echo> <SCP file = "$ {build. file} "verbose =" true "todir =" $ {web. host. user }@$ {web. host }:$ {web. host. webroot }/.. /builds "passphrase =" "Port =" 2016 "Keyfile =" $ {web. host. PWD} "Trust =" true "/> </Target>