ANT-无法加载相关类com/jcraft/jsch/Logger [英] ANT - Could not load a dependent class com/jcraft/jsch/Logger
问题描述
我的Ant脚本有问题.
I have a problem with my Ant script.
我需要将文件复制到Linux服务器
I need to copy a file to Linux server
<copy file="../Ant/lib/jsch-0.1.50.jar" tofile="${ant.home}/lib/jsch-0.1.50.jar" />
<scp todir="${server.user}:${server.password}@${server.dev}:${server.dev.dir.config}" trust="true" verbose="true">
<fileset dir="${src.home}/Config/">
<include name="**/*" />
</fileset>
</scp>
文件已正确复制,但出现此错误:
File is copied correctly, but I receive this error:
BUILD FAILED
C:\dev.xml:179: Problem: failed to create task or type scp
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.
Action: Determine what extra JAR files are needed, and place them in one of:
-C:\Progs\eclipse\plugins\org.apache.ant_1.8.3.v201301120609\lib
-C:\Users\Administrator\.ant\lib
-a directory added on the command line with the -lib argument
如何在Ant类加载器中动态添加此JAR?
How can I dynamically add this JAR in the Ant classloader?
推荐答案
异常本身非常清楚,并指出了问题的原因:
The Exception itself is quite clear and points the reason of the problem:
Action: Determine what extra JAR files are needed, and place them in one of:
-C:\Progs\eclipse\plugins\org.apache.ant_1.8.3.v201301120609\lib
-C:\Users\Administrator\.ant\lib
-a directory added on the command line with the -lib argument
请从库依赖项
jsch.jar 0.1.50或更高版本:sshexec和scp任务( http://www. jcraft.com/jsch/index.html )
jsch.jar 0.1.50 or later: sshexec and scp tasks (http://www.jcraft.com/jsch/index.html)
如果将此库复制到ant库中,它将解决独立Ant的问题.
If you copy this lib in the ant lib it will solve the issue for the standalone Ant.
对于Eclipse而言:在Ant/Runtime条目的"Classpath"选项卡中,进入Eclipse Preferences.使用按钮添加外部Jars"将jsch.jar添加到Ant的类路径中.
And for the case of Eclipse: Go into the Eclipse Preferences, in the Ant/Runtime entry, in the 'Classpath' tab. Use the button 'Add External Jars' to add your jsch.jar to Ant's classpath.
这篇关于ANT-无法加载相关类com/jcraft/jsch/Logger的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!