ant应用举例—远程部署web应用
打包好web应用时,有时候上传也是比较烦琐,ant需要jsch.jar,可以到SourceForge:jsch,把它放到ant能找到地方,可以放到ANT_HOME/lib下。
然后写target:
- <target name="copy.to.remote" depends="war">
- <scp file="${build.dir}/${project.name}.war" todir="${scp.username}:${scp.passwd}@${scp.host}:${scp.path}" port="22" trust="true" verbose="true"></scp>
- </target>
延伸:
•使用时报 com.jcraft.jsch.JSchException: reject HostKey: 192.168.0.123。是没有加 trust=”true”,把它加上就好了。
•在 eclipse 中加 ant 额外的lib:首选项->Ant->Runtime->ClassPath->Global Entries,添加额外的jar
没有评论▼