title: Could not find method sonarProperties()
body: <p>I'm trying to configure <code>build.gradle</code> for generating and uploading code coverage report to sonar</p>
  
  <pre><code>import static org.apache.tools.ant.taskdefs.condition.Os.*
  
  buildscript {
    repositories {
      maven {
        url "https://plugins.gradle.org/m2/"
      }
    }
    dependencies {
      classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1"
    }
  }
  
   plugins {
     id "org.sonarqube" version "2.6.1"
     id "java" 
   }
  
  task sonarRunner {
          sonarProperties {
                  property "sonar.host.url", sonar.host.url
                  property "sonar.organization", sonar.organization
                  property "sonar.projectKey", sonar.projectKey
                  property "sonar.login", sonar.login
                  property "sonar.jacoco.reportPath", sonar.jacoco.reportPath
          }
  }
  
  task generateReport {
          exec {
            commandLine 'ant', 'jacoccoalltests', '-Dtestclasses.extensions=' + code.coverage.extensions
        }
  
  }
  
  task checkOs() &lt;&lt; {
      if (Os.isFamily(Os.FAMILY_WINDOWS)) {
          commandLine 'setantenv.bat'
      }
      if(Os.isFamily(Os.FAMILY_UNIX)) {
          exec {
            executable "./setantenv.sh"
          }
      }
      if(Os.isFamily(Os.FAMILY_MAC)) {
          exec {
            executable ". ./setantenv.sh"
          }
      }
  }
  
  sonarRunner.dependsOn generateReport
  generateReport.dependsOn checkOs
  </code></pre>
  
  <p>When I run <strong>./gradlew clean build</strong> I have the following error</p>
  
  <blockquote>
    <p>Caused by:
    org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException:
    Could not find method sonarProperties() for arguments
    [build_5g79eps6d8kumu5fvgq9l0s46$_run_closure1$_closure5@1f58d70] on
    task ':sonarRunner' of type org.gradle.api.DefaultTask</p>
  </blockquote>
  
  <p>How can I fix this problem?</p>