java 蚂蚁 scp 失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11092216/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 03:43:56  来源:igfitidea点击:

ant scp failure

javaantscp

提问by riship89

This is how I am trying to scp to a remote machine, I am trying to copy whole directory to destination directory.

这就是我尝试 scp 到远程机器的方式,我试图将整个目录复制到目标目录。

<target name="report-test-results" depends="run-junit-tests">
    <scp todir="root:[email protected]:/home/hrishikesh/webui-test-results/">
            <fileset dir="${basedir}/test-results"/>
    </scp>
</target>

I am getting following error:

我收到以下错误:

BUILD FAILED
C:\Users\hrishikesh\workspace\selenium4j\build.xml:122: 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:
        -ANT_HOME\lib
        -the IDE Ant configuration dialogs

Do not panic, this is a common problem.
The commonest cause is a missing JAR.

This is not a bug; it is a configuration problem

回答by gareth_bowles

The error output is pretty clear on how to fix this:

错误输出非常清楚如何解决这个问题:

Action: Determine what extra JAR files are needed, and place them in one of:
    -ANT_HOME\lib
    -the IDE Ant configuration dialogs

In your case you're missing the jsch JAR file, which can be downloaded from the JSch site.

在您的情况下,您缺少 jsch JAR 文件,该文件可以从JSch 站点下载。

回答by krock

Checkout the library dependanciesfor the scptask. You need to include jsch.jarin your classpath.

签出库的依赖关系scp任务。您需要包含jsch.jar在您的类路径中。

回答by Avnit Bambah

Add the JSchJAR file inside Eclipse - Windows > Preferences > Ant > Classpath.

在 Eclipse - Windows > Preferences > Ant > Classpath 中添加JSchJAR 文件。

You can get the JAR filefrom the Maven Central Repository.

您可以从 Maven 中央存储库获取JAR 文件