Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ant + scp " Watch "ant + scp " New topic
Author

ant + scp

neeraj nandwana
Greenhorn

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

scp.deploy:
[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

BUILD FAILED
com.jcraft.jsch.JSchException: 2: No such file
at org.apache.tools.ant.taskdefs.optional.ssh.ScpToMessageBySftp.doSingleTransfer(ScpToMessageBySftp.java:137)
at org.apache.tools.ant.taskdefs.optional.ssh.ScpToMessageBySftp.execute(ScpToMessageBySftp.java:125)
........


here is my code


and i am using
Apache Ant version 1.7.1
Java version: 1.5
jsch-0.1.42.jar

Any help please

Thanks in advance

Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

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
Greenhorn

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: ant.project.name -> 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:
+Target: scp.about
+Target: scp.config
+Target: scp.deploy
[antlibrg.apache.tools.ant] 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 -> 10.52.107.142:22
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 org.apache.tools.ant.helper.DefaultExecutor
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
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ant + scp