ant自动上传

xiaoxiao2021-02-28  76

1、下载jsch.jar

http://sourceforge.NET/projects/jsch/files/jsch.jar/

 

2、保存一下内容,命名为build.xml在d:/antHome目录下

 

<project name="AntAutoDeploy" basedir="../" default="scp">     <target name="scp">         <scp file="myfile.txt" todir="test@172.10.10.98:/home/" trust="true" password="123456" />     </target> </project>

 

3、把jsch.jar复制到d:/antHome下

4、执行 ant -lib d:/antHome

 

在eclipse运行需要下载jsch.jar 并且设置到eclipse中

 

运行build.xml出现异常: Cause: Could not load a dependent class com/jcraft/jsch/Logger           It is not enough to have Ant's optional JARs           you need the JAR files that the optional tasks depend upon.           Ant's optional task dependencies are listed in the manual. 解决方法: 加入jsch-x.x.x.jar Go to Window > Preferences > Ant > Runtime > Classpath, select “Ant Home Entries (default)” and click “Add External JARs…”. Select the required dependency or dependencies and accept. Now, the selected JAR files will be loaded to the class path and the optional ant task depending on them will work

转载请注明原文地址: https://www.6miu.com/read-79275.html

最新回复(0)