Eclipse中使用Ant远程发布War包

环境:

MyEclipse10.0

jsch-0.1.46.jar-http://www.jcraft.com/jsch/

1.将jsch-0.1.46.jar复制到D:\ProgramFiles\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-RunAs-AntBuild

相关推荐