ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rhino" <rhi...@sympatico.ca>
Subject Scp problem
Date Fri, 08 Oct 2004 14:14:12 GMT

I am trying the optional Scp task for the first time but it isn't working too well. I need
some help.

I downloaded jsch-0.1.17.jar from http://www.jcraft.com/jsch/index.html and put it in my ant/lib
directory. This is my Ant script except that I have spoofed the userid and password for obvious
reasons:

-----------------------------------------------------------------------------------------------
<?xml version="1.0" ?>

<project name="SSH" default="scp" basedir=".">
<description>Experiment with optional Ant tasks that use SSH.
</description>


<target name="scp" description="scp copies local files to remote machines via SSH">
<scp file="C:/Answer.txt" todir="myuser:mypass@tonge.ca:/home/rhino"/>

</target>

<target name="sshexec" description="sshexec is an SSH command line">

</target>
</project>

-----------------------------------------------------------------------------------------------

This is the result I get:

-----------------------------------------------------------------------------------------------
D:\RDS\xml>ant -f ssh.xml -debug -verbose
Apache Ant version 1.6.1 compiled on February 12 2004
Apache Ant version 1.6.1 compiled on February 12 2004
Buildfile: ssh.xml
Detected Java version: 1.4 in: C:\j2sdk1.4.1_02\jre
Detected OS: Windows XP
parsing buildfile D:\RDS\xml\ssh.xml with URI = file:///D:/RDS/xml/ssh.xml
Project base dir set to: D:\RDS\xml
Build sequence for target `scp' is [scp]
Complete build sequence is [scp, sshexec, ]

scp:
      [scp] Connecting to tonge.ca:22

BUILD FAILED
D:\RDS\xml\ssh.xml:14: com.jcraft.jsch.JSchException: reject HostKey
        at org.apache.tools.ant.taskdefs.optional.ssh.Scp.execute(Scp.java:129)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:301)
        at org.apache.tools.ant.Target.performTasks(Target.java:328)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
        at org.apache.tools.ant.Main.runBuild(Main.java:632)
        at org.apache.tools.ant.Main.startAnt(Main.java:183)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
Caused by: com.jcraft.jsch.JSchException: reject HostKey
        at com.jcraft.jsch.Session.checkHost(Unknown Source)
        at com.jcraft.jsch.Session.connect(Unknown Source)
        at com.jcraft.jsch.Session.connect(Unknown Source)
        at org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBa
e.java:167)
        at org.apache.tools.ant.taskdefs.optional.ssh.Scp.upload(Scp.java:190)
        at org.apache.tools.ant.taskdefs.optional.ssh.Scp.execute(Scp.java:118)
        ... 10 more
--- Nested Exception ---
com.jcraft.jsch.JSchException: reject HostKey
        at com.jcraft.jsch.Session.checkHost(Unknown Source)
        at com.jcraft.jsch.Session.connect(Unknown Source)
        at com.jcraft.jsch.Session.connect(Unknown Source)
        at org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBa
e.java:167)
        at org.apache.tools.ant.taskdefs.optional.ssh.Scp.upload(Scp.java:190)
        at org.apache.tools.ant.taskdefs.optional.ssh.Scp.execute(Scp.java:118)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:301)
        at org.apache.tools.ant.Target.performTasks(Target.java:328)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
        at org.apache.tools.ant.Main.runBuild(Main.java:632)
        at org.apache.tools.ant.Main.startAnt(Main.java:183)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

Total time: 2 seconds
D:\RDS\xml>
-----------------------------------------------------------------------------------------------

What did I do wrong and how do I fix it?

When I searched the archives for this mailing list, I found a note that said you need to have
a hosts file that is visible to the script but the reply didn't make it clear (to me) how
that is done.

The local file is on my Windows XP machine; the remote server is running Linux Mandrake 9.1.



Rhino
---
rhino1 AT sympatico DOT ca
"There are two ways of constructing a software design. One way is to make it so simple that
there are obviously no deficiencies. And the other way is to make it so complicated that there
are no obvious deficiencies." - C.A.R. Hoare
Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message