title: How to FTP a file from an Android Gradle build?
body: <p>I'm trying to FTP the signed APK after a Gradle build. I've already added the new build config that will sign the APK, but I'm stuck trying to figure out how to invoke an FTP task. </p>
  
  <p>I found an official looking sample at <a href="http://www.gradle.org/docs/current/userguide/organizing_build_logic.html" rel="noreferrer">section 59.6</a>, however it complains that it cannot resolve dependency org.apache.ant:ant-commons-net:1.8.4. So apparently I'm missing something obvious here, like where to put a given jar file or reference it, although I thought maven would handle this sort of thing?</p>
  
  <p>For reference, here is the linked sample which fails with a message about the dependency:</p>
  
  <pre><code>configurations {
      ftpAntTask
  }
  
  dependencies {
      ftpAntTask("org.apache.ant:ant-commons-net:1.8.4") {
          module("commons-net:commons-net:1.4.1") {
              dependencies "oro:oro:2.0.8:jar"
          }
      }
  }
  
  task ftp &lt;&lt; {
      ant {
          taskdef(name: 'ftp',
                  classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
                  classpath: configurations.ftpAntTask.asPath)
          ftp(server: "ftp.apache.org", userid: "anonymous", password: "me@myorg.com") {
              fileset(dir: "htdocs/manual")
          }
      }
  }
  </code></pre>
  
  <p>This fails with the message:</p>
  
  <pre><code>&gt; Could not find org.apache.ant:ant-commons-net:1.8.4.
  </code></pre>
  
  <p>Here is my complete gradle.build file, with some sensitive information removed:</p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.4'
      }
  }
  
  apply plugin: 'android'
  
  dependencies {
      compile files('libs/android-support-v4.jar')
  }
  
  android {
      compileSdkVersion 17
      buildToolsVersion "17.0.0"
  
      defaultConfig {
          minSdkVersion 14
          targetSdkVersion 17
      }
  
      signingConfigs {
          signed {
              storeFile file("(removed)")
              storePassword "(removed)"
              keyAlias "(removed)"
              keyPassword "(removed)"
          }
       }
  
      buildTypes {
          signed {
              debuggable false
              jniDebugBuild false
              signingConfig signingConfigs.signed
          }
      }
  }
  
  configurations {
      ftpAntTask
  }
  
  dependencies {
      ftpAntTask("org.apache.ant:ant-commons-net:1.8.4") {
          module("commons-net:commons-net:1.4.1") {
              dependencies "oro:oro:2.0.8:jar"
          }
      }
  }
  
  task ftp &lt;&lt; {
      ant {
          taskdef(name: 'ftp',
                  classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
                  classpath: configurations.ftpAntTask.asPath)
          ftp(server: "(removed)", userid: "(removed)", password: "(removed)", remoteDir: "(removed)") {
              fileset(dir: "(removed)") {
                  include(name: "(removed)")
              }
          }
      }
  }
  </code></pre>