• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Help with Ant -FTP Task

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,
I am trying to use the FTP task with Ant 1.5.3. I have included the jakarta-oro-2.0.1.jar and commons-net-1.2.2.jar in the lib directory of Ant. In the build.xml I have

<taskdef name="ftp" classname="org.apache.commons.net.ftp.FTPClient" classpath="${ant.home}/lib/commons-net-1.2.2.jar;c:/ant/lib/jakarta-oro-2.0.1.jar" />

When I execute the build.xml I am getting the following Error

ftpTransfer:
No public execute() in class org.apache.commons.net.ftp.FTPClient

BUILD FAILED
file:C:/build.xml:76: No public execute() in class org.apache.commons.
net.ftp.FTPClient
at org.apache.tools.ant.TaskAdapter.checkTaskClass(TaskAdapter.java:108)

at org.apache.tools.ant.Project.checkTaskClass(Project.java:961)
at org.apache.tools.ant.Project.addTaskDefinition(Project.java:923)
at org.apache.tools.ant.taskdefs.Taskdef.addDefinition(Taskdef.java:82)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:232)

at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:162)
at org.apache.tools.ant.Task.perform(Task.java:341)
at org.apache.tools.ant.Target.execute(Target.java:309)
at org.apache.tools.ant.Target.performTasks(Target.java:336)
at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
at org.apache.tools.ant.Main.runBuild(Main.java:609)
at org.apache.tools.ant.Main.start(Main.java:196)
at org.apache.tools.ant.Main.main(Main.java:235)

Total time: 0 seconds
========================================================
After this I replaced the classname attribute in <taskdef> with org.apache.commons.net.ftp.FTP . But I get the following error

ftpTransfer:
No public execute() in class org.apache.commons.net.ftp.FTP

BUILD FAILED
file:C:/build.xml:76: No public execute() in class org.apache.commons.
net.ftp.FTP
at org.apache.tools.ant.TaskAdapter.checkTaskClass(TaskAdapter.java:108)

at org.apache.tools.ant.Project.checkTaskClass(Project.java:961)
at org.apache.tools.ant.Project.addTaskDefinition(Project.java:923)
at org.apache.tools.ant.taskdefs.Taskdef.addDefinition(Taskdef.java:82)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:232)

at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:162)
at org.apache.tools.ant.Task.perform(Task.java:341)
at org.apache.tools.ant.Target.execute(Target.java:309)
at org.apache.tools.ant.Target.performTasks(Target.java:336)
at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
at org.apache.tools.ant.Main.runBuild(Main.java:609)
at org.apache.tools.ant.Main.start(Main.java:196)
at org.apache.tools.ant.Main.main(Main.java:235)

Total time: 0 seconds

Can anybody please suggest a remedy for this.
Thanks in advance.
cheers,
Wap
 
Wap Ed
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,
Well I had to include NetComponents.jar in the classpath ( or in the ${ANT_HOME}/lib ) directory. This is applicable for Ant V1.5.3. For versions Ant V1.6.0 and above, commons-net.jar is required,
cheers,
Wap
 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FTP is supplied as an optional task already in 1.5.3, the task supplied has a dependency on commons-net and oro? in your ant/lib.

Remove the taskdef tag, and use as per the ant docs.


<ftp action="get"
server="${ftp.server}"
userid="${ftp.username}"
password="${ftp.password}"
remotedir="${ftp.remotedir}"
passive="yes"
verbose="yes"
depends="no"
binary="yes"
>
<fileset dir="${ftp.localdir}">
<include name="${ftp.filespec}"/>
</fileset>
</ftp>

 
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic