permaculture playing cards
The moose likes Ant, Maven and Other Build Tools and the fly likes ant + scp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ant + scp " Watch "ant + scp " New topic

ant + scp

neeraj nandwana

Joined: Sep 17, 2007
Posts: 6
i am trying to push a file to server by sftp but i am getting error

[scp] Connecting to x.x.x.x:22
[scp] Sending: myfile.txt : 20
[scp] File transfer time: 0.97 Average Rate: 20.66 B/s

com.jcraft.jsch.JSchException: 2: No such file

here is my code

and i am using
Apache Ant version 1.7.1
Java version: 1.5

Any help please

Thanks in advance

Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

Run ant in debug mode, it should give you more info.

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
neeraj nandwana

Joined: Sep 17, 2007
Posts: 6
Thanks Martijn for reply
i am running ant in debug mode and it's showing this extra information

Apache Ant version 1.7.1 compiled on June 27 2008
Buildfile: build.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.5 in: C:\Program Files\Java\jdk1.5.0_09\jre
Detected OS: Windows XP
Adding reference: ant.ComponentHelper
Setting ro project property: ant.file -> D:\test\upload\build.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile D:\test\upload\build.xml with URI = file:/D:/test/upload/build.xml
Setting ro project property: -> alogix
Adding reference: alogix
Setting ro project property: ant.file.alogix -> D:\test\upload\build.xml
Project base dir set to: D:\test\upload
+Target: scp.about
+Target: scp.config
+Target: scp.deploy
[] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.
Setting project property: ant.configFile -> D:\test\upload\antconfig.txt
Setting project property: scp.server ->
Setting project property: scp.dir -> /u/username/builds/
Setting project property: scp.password -> password
Setting project property: scp.user -> username
Attempting to create object of type
Adding reference: ant.executor
Build sequence for target(s) `scp.deploy' is [scp.about, scp.config, scp.deploy]
Complete build sequence is [scp.about, scp.config, scp.deploy, ]

but still can't figure it out what is the problem.
host is running on SunOs and i am using sftp to upload the file.
Is some problem with the authentication ???
Any guess ...

Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

You need to check the section of the log in debug mode where it tries to upload the file, you should see it try to resolve the full path to your file before uploading it. You want to make sure that that path is correct first.
I agree. Here's the link:
subject: ant + scp
It's not a secret anymore!