aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant scp task giving Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant scp task giving Error" Watch "Ant scp task giving Error" New topic
Author

Ant scp task giving Error

sasank ch
Greenhorn

Joined: Nov 07, 2007
Posts: 25
Hi All,

I have one requirement, to copy the local files to remote system.
I have done the following steps:

download the jsch-0.1.40.jar;
E:\AntTest>set path=E:\AntTest\jsch-0.1.40.jar;%path%;
E:\AntTest>set classpath=E:\AntTest\jsch-0.1.40;%classpath%;


E:\AntTest>ant copyFileToRemote
Buildfile: build.xml

copyFileToRemote:
[echo] 2222222222 copyFileToRemote Examples:::::::::::::

BUILD FAILED
E:\AntTest\build.xml:28: Could not create task or type of type: scp.
Ant could not find the task or a class this task relies upon.
This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'scp'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
Fix: check the documentation for dependencies.
Fix: declare the task.
- The task is an Ant optional task and the JAR file and/or libraries
implementing the functionality were not found at the time you
yourself built your installation of Ant from the Ant sources.
Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
task and make sure it contains more than merely a META-INF/MANIFEST.MF.
If all it contains is the manifest, then rebuild Ant with the needed
libraries present in ${ant.home}/lib/optional/ , or alternatively,
download a pre-built release version from apache.org
- The build file was written for a later version of Ant
Fix: upgrade to at least the latest release version of Ant
- The task is not an Ant core or optional task
and needs to be declared using <taskdef>.
- You are attempting to use a task defined using
<presetdef> or <macrodef> but have spelt wrong or not
defined it at the point of use

The Build file as follows:

<project name="ImportedBuild" default="all">
<target name="copyFileToRemote">
<echo>2222222222 copyFileToRemote Examples:::::::::::::</echo>
<scp file="sample.txt" todir="${username}:${password}@${hostname}:/shared"/>
</target>
</project>


Could you please give me any solution to resolve this issus and provide any examples . It would be great help to me.

Regards,
Sam
Amir Iqbal
Ranch Hand

Joined: Jun 23, 2007
Posts: 97
Dear Sasank,

There are two possibilities:

1)

the "jsch-0.1.40.jar" file is not working. means i also face this problem. that i do have this jar in my lib folder but still its not working.
so try to seprately download a newer jsc.jar and then place it in your classpath.

2)

you said you need the sample code so here is my sample code :



Regards,


i am Java +ve Now !
sasank ch
Greenhorn

Joined: Nov 07, 2007
Posts: 25
Dear Amir,

Thank you for your Replay.

Could you please let me know, Where will i get the antlib.xml.

I think, because of the xml file missing, I am getting the following error:
Could not create task or type of type: trycatch.

<taskdef resource="net/sf/antcontrib/antlib.xml" />

Regards,
Sasank
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
You need ant-contrib-version.jar http://ant-contrib.sourceforge.net/tasks/index.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ant scp task giving Error
 
Similar Threads
Mod_jk NEED HELP!!!
problem in web services
Ant ftp task creating problem
ANT could not find class for <junit>
Ant classpath not working