ANT - 无法加载依赖类 com/jcraft/jsch/Logger

2024-01-27

我的 Ant 脚本有问题。

我需要将文件复制到 Linux 服务器

<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>

文件已正确复制,但我收到此错误:

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?


异常本身非常清楚并指出了问题的原因:

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

请检查来自库依赖项 http://ant.apache.org/manual/install.html#librarydependencies

jsch.jar 0.1.50 或更高版本:sshexec 和 scp 任务(http://www.jcraft.com/jsch/index.html http://www.jcraft.com/jsch/index.html)

如果您将此库复制到 ant 库中,它将解决独立 Ant 的问题。

对于 Eclipse 的情况:进入 Eclipse Preferences,在 Ant/Runtime 条目的“Classpath”选项卡中。使用“添加外部 Jars”按钮将 jsch.jar 添加到 Ant 的类路径中。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ANT - 无法加载依赖类 com/jcraft/jsch/Logger 的相关文章

随机推荐