title: Gradle Unable to run checkstyle
body: <p>I have a java project on my laptop and I am building it with gradle.
  All dependencies are in file system as I am off line most of the time when working on it. They are not too many anyway.</p>
  
  <p><strong>build.gradle:</strong></p>
  
  <pre><code>repositories {
      flatDir {
          dirs "${rootDir}/lib/main", "${rootDir}/lib/test", "${rootDir}/lib/quality"
      }
  }
  
  ext.configDir = "${rootDir}/gradle/config"
  ext.scriptsDir = "${rootDir}/gradle/scripts"
  </code></pre>
  
  <p>Now I need to add some quality checks against my code. I was lucky to get PMD checks working but not so lucky with checkstyle. The example from gradle distribution, the gradle in action book I read, the gradle documentation does not seem to be rocket science but I just cant get it to work which become very frustrating, especially that with ant that would have been a five minutes task. Anyway this is my <strong>gradle.build</strong> entry for checkstyle:</p>
  
  <pre><code>apply from: "${scriptsDir}/checkstyle.gradle"
  </code></pre>
  
  <p>and this is my <strong>checkstyle.gradle</strong> (partially shown):</p>
  
  <pre><code>apply plugin: 'checkstyle'
  
  ext.checkstyleConfigDir = new File(configDir, "checkstyle")
  ext.checkstyleReportsDir = new File(reportsDir, "checkstyle")
  ext.xslStyleFile = new File(checkstyleConfigDir, "checkstyle-noframes.xsl")
  
  checkstyle {
      toolVersion = '6.10.1'
      configFile = new File(checkstyleConfigDir, 'sun_checks.xml')
      ignoreFailures = true
      showViolations = true
  }
  
  checkstyleMain.doLast {
      def main = new File(checkstyleReportsDir, "main.xml")
      if (main.exists()) {
          ant.xslt(in: main, style: xslStyleFile, out: new File(checkstyleReportsDir, "main.html"))
      }
  }
  
  dependencies {
      checkstyle( 'com.puppycrawl.tools:checkstyle:6.10.1' )
  }
  </code></pre>
  
  <p>However when running my build the checkstyle task fails like below:</p>
  
  <pre><code>* What went wrong:
  Execution failed for task ':checkstyleMain'.
  &gt; java.lang.ClassNotFoundException: com.puppycrawl.tools.checkstyle.CheckStyleTask
  </code></pre>
  
  <p>Looking inside the checkstyle-6.10.1.jar I can see there is not such a class as <code>com.puppycrawl.tools.checkstyle.CheckStyleTask</code> but there is one called <code>com.puppycrawl.tools.checkstyle.ant.CheckStyleAntTask</code> instead and I suspect this is the one that gradle should invoke. However I have no idea about how to make gradle invoke that.</p>
  
  <p>The only one suspition I have is that my <code>toolVersion = '6.10.1'</code> is not properly defined and gradle invokes using some default. However all gradle api documentation says about that is this: <strong>"String toolVersion The version of the code quality tool to be used."</strong> </p>
  
  <p>So what I am doing wrong and how should I fix it.</p>
  
  <p>Thank you in advance for your inputs.</p>