ant scp失败

时间:2012-06-18 22:53:10

标签: java ant scp

这是我尝试scp到远程计算机的方法,我正在尝试将整个目录复制到目标目录。

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

我收到以下错误:

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

3 个答案:

答案 0 :(得分:7)

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

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

在您的情况下,您错过了jsch JAR文件,该文件可以从JSch site下载。

答案 1 :(得分:4)

检查scp {{1}}任务的library dependancies。您需要在类路径中包含jsch.jar

答案 2 :(得分:-2)

在Eclipse中添加JSch JAR文件 - Windows&gt;偏好&gt;蚂蚁&gt;类路径

您可以从Maven Central Repository获取JAR file