title: ant: ftp task failing due to NoClassDefFoundError
body: <p>I have been following some example source code
  but I am getting an error upon executing the ftp task.
  Here is my build.xml file:</p>
  
  <pre><code>?xml version="1.0"?&gt;
  &lt;project name="HelloWorld" default="deploy"&gt;
    &lt;target name="init"&gt;
      &lt;mkdir dir="build/classes" /&gt;
      &lt;mkdir dir="dist" /&gt;
    &lt;/target&gt;
    &lt;target name="compile" depends="init"&gt;
      &lt;javac includeantruntime="false"
        srcdir="src"
        destdir="build/classes"/&gt;
    &lt;/target&gt;
    &lt;target name="doc" depends="init"&gt;
      &lt;javadoc destdir="build/classes"
        sourcepath="src"
        packagenames="org.*" /&gt;
    &lt;/target&gt;
    &lt;target name="package" depends="compile,doc"&gt;
      &lt;jar destfile="dist/project.jar"
        basedir="build/classes" /&gt;
    &lt;/target&gt;
    &lt;taskdef name="ftp" classname="org.apache.tools.ant.taskdefs.optional.net.FTP"&gt;
      &lt;classpath&gt;
        &lt;pathelement location="/usr/local/ant/lib/ant-commons-net.jar"/&gt;
      &lt;/classpath&gt;
    &lt;/taskdef&gt;
    &lt;target name="deploy" depends="package"&gt;
      &lt;ftp classname="org.apache.tools.ant.taskdefs.optional.net.FTP"
        server="${server.name}"
        userid="${ftp.username}"
        password="${ftp.password}"&gt;
        &lt;fileset dir="dist" /&gt;
      &lt;/ftp&gt;
    &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Here are some settings:</p>
  
  <pre><code>$ ant -version
  Apache Ant(TM) version 1.9.0 compiled on March 5 2013
  $ echo $ANT_HOME
  /usr/local/ant
  $ ls -l $ANT_HOME
  lrwxrwxrwx 1 root root 17 May 20 11:54 /usr/local/ant -&gt; apache-ant-1.9.0/
  </code></pre>
  
  <p>Here is the output with the error I am getting.
  I thought ant build files were supposed to be portable.
  What is the problem here? Somehow the "Ant" FTP task
  looks for a class name which is coming from a class
  which is not distributed with ant. I tried pointing
  the task to the class distributed with ant but ant
  still does not seem to find the class corresponding
  to the ftp task which it is looking for.</p>
  
  <pre><code>Buildfile: /home/johndoe/ex/build.xml
  
  init:
  
  compile:
  
  doc:
    [javadoc] Generating Javadoc
    [javadoc] Javadoc execution
    [javadoc] Loading source files for package org.example.helloworld...
    [javadoc] Constructing Javadoc information...
    [javadoc] Standard Doclet version 1.7.0_21
    [javadoc] Building tree for all the packages and classes...
    [javadoc] Building index for all the packages and classes...
    [javadoc] Building index for all classes...
  
  package:
        [jar] Building jar: /home/johndoe/ex/dist/project.jar
  
  deploy:
  
  BUILD FAILED
  /home/johndoe/ex/build.xml:30: Could not create type ftp due to java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClientConfig
      at org.apache.tools.ant.taskdefs.optional.net.FTP$LanguageCode.getValidLanguageCodes(FTP.java:2698)
      at org.apache.tools.ant.taskdefs.optional.net.FTP$LanguageCode.&lt;clinit&gt;(FTP.java:2694)
      at org.apache.tools.ant.taskdefs.optional.net.FTP.&lt;init&gt;(FTP.java:137)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
      at org.apache.tools.ant.AntTypeDefinition.innerCreateAndSet(AntTypeDefinition.java:328)
      at org.apache.tools.ant.AntTypeDefinition.createAndSet(AntTypeDefinition.java:274)
      at org.apache.tools.ant.AntTypeDefinition.icreate(AntTypeDefinition.java:219)
      at org.apache.tools.ant.AntTypeDefinition.create(AntTypeDefinition.java:206)
      at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:285)
      at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:263)
      at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:417)
      at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
      at org.apache.tools.ant.Task.perform(Task.java:347)
      at org.apache.tools.ant.Target.execute(Target.java:435)
      at org.apache.tools.ant.Target.performTasks(Target.java:456)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
      at org.apache.tools.ant.Main.runBuild(Main.java:851)
      at org.apache.tools.ant.Main.startAnt(Main.java:235)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
  Caused by: java.lang.ClassNotFoundException: org.apache.commons.net.ftp.FTPClientConfig
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
      ... 26 more
  
  Total time: 2 seconds
  </code></pre>
  
  <p>Ideally I shouldn't have to download other classes to get ant to work. It should
  work out of the box, otherwise it is not that portable. Plus, if someone could
  help me with where to download the classes that are missing it would be of
  great help.</p>
  
  <p>Thanks.</p>