title: 'mavenDeployer' cannot be applied to '(groovy.lang.Closure)'
body: <p>I am attempting to develop my own Android Studio Gradle plugin.</p>
  
  <p>To gain some experience on how to achieve this I am following <a href="https://afterecho.uk/blog/create-a-standalone-gradle-plugin-for-android-a-step-by-step-guide.html" rel="nofollow noreferrer">this</a> tutorial</p>
  
  <p>I have go to the point where I amend the <code>gradle.build</code> file as follows:-</p>
  
  <pre><code>apply plugin: 'maven'
  
  uploadArchives {
      repositories {
          mavenDeployer {
              repository(url: uri('repo'))
          }
      }
  }
  </code></pre>
  
  <p>I seem to have an issue at this line:-</p>
  
  <pre><code>repository(url: uri('repo'))
  </code></pre>
  
  <p>"repository" is underlined and I see this message:-</p>
  
  <pre><code>'mavenDeployer' cannot be applied to '(groovy.lang.Closure)'
  </code></pre>
  
  <p>I cannot resolve this issue</p>
  
  <p>What have a done wrong?</p>
  
  <p>UPDATE</p>
  
  <p>When I executed the <code>uploadArchives</code> task
  I was getting this error:-</p>
  
  <pre><code>16:47:32: Executing external task 'uploadArchives'...
  :compileJava NO-SOURCE
  :compileGroovy FAILED
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':compileGroovy'.
  &gt; java.lang.ExceptionInInitializerError (no error message)
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  
  BUILD FAILED
  
  Total time: 0.817 secs
  Conflicting module versions. Module [groovy-all is loaded in version 2.4.10 and you are trying to load version 2.3.11
  16:47:33: External task execution finished 'uploadArchives'.
  </code></pre>
  
  <p>This was because my <code>gradle.build</code> file looked like this:-</p>
  
  <pre><code>group 'org.group.id'
  version '1.0-SNAPSHOT'
  
  apply plugin: 'groovy'
  apply plugin: 'java'
  
  sourceCompatibility = 1.8
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      compile 'org.codehaus.groovy:groovy-all:2.3.11'
      testCompile group: 'junit', name: 'junit', version: '4.12'
      compile gradleApi()
      compile localGroovy()
  }
  
  apply plugin: 'maven'
  
  uploadArchives {
      repositories {
          mavenDeployer {
              repository(url: uri('repo'))
          }
      }
  }
  </code></pre>
  
  <p>When I removed "compile 'org.codehaus.groovy:groovy-all:2.3.11'" and executed the uploadArchives task it all started working ok. Although I still have the same message 'mavenDeployer' cannot be applied to '(groovy.lang.Closure)'</p>
  
  <p>The output I get when executing the uploadArchives task is:-</p>
  
  <pre><code>16:52:00: Executing external task 'uploadArchives'...
  :compileJava NO-SOURCE
  :compileGroovy UP-TO-DATE
  :processResources NO-SOURCE
  :classes UP-TO-DATE
  :jar UP-TO-DATE
  :uploadArchives
  
  BUILD SUCCESSFUL
  
  Total time: 0.126 secs
  16:52:00: External task execution finished 'uploadArchives'.
  </code></pre>