下载的 j2ssh-ant.jar, j2ssh-core.jar, jsch.jar. (附近里也有)
http://www.findjar.com/jar/com/jcraft/jsch/0.1.24/jsch-0.1.24.jar.html
从Linux拷贝单个文件到远端服务器Windows:
<target name="scp">
<scp
file="/home/cluster/JReport/BUG.ZIP"
todir="Administrator:[email protected]:/E:/TestResultsArchive/V10Cluster/Cluster80-Linux64bit/"
trust="true"/>
</target>
遇到一个问题:com.jcraft.jsch.JSchException: connection is closed by foreign host
由于windows的本身是不支持SSH协议的,所以要想在ant中执行scp命令就必须在windows中安装ssh for windows的客户端软件,例如winsshd,安装完成后就可以启动windows的ssh服务了,然后再试scp命令,传送成功!