Eclipse中使用Ant远程发布War包

环境:
MyEclipse 10.0
jsch-0.1.46.jar -http://www.jcraft.com/jsch/

1.将jsch-0.1.46.jar复制到D:\Program Files\MyEclipse\Common\plugins\org.apache.ant_1.8.2.v20110505-1300\lib目录下;
2.在MyEclipse的window->preferences->ant->runtime->classpath中加入jsch-0.1.46.jar;
3.web工程下建立文件deploy.properties
war=hello
#上传ftp服务器的相关参数
server=192.168.0.1
username=root
password=root
remotedir=/usr/local/tomcat/webapps

和deploy.xml
<?xml version="1.0" encoding="UTF-8"?> 
<project name="hello" default="ftp" basedir="."> 	 
    <property file="deploy.properties" />
    <target name="ftp">
        <scp file="${war}.war" todir="${username}:${password}@${server}:${remotedir}" trust="true"/>
    </target>
</project> 

4.导出工程到war包;
deploy.xml-Run As-Ant Build

你可能感兴趣的:(eclipse,ant,scp,sftp,war)