title: Use PMD's Copy/Paste Detector with Gradle
body: <p>I'd like to use Copy/Paste Detector in my Gradle build.</p>
  
  <p>This is why I've decided to translate the following Ant task (which I've found <a href="http://pmd.sourceforge.net/pmd-5.0.1/cpd-usage.html" rel="nofollow">here</a>) into Gradle syntax:</p>
  
  <pre><code>&lt;target name="cpd"&gt;
      &lt;taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" /&gt;
      &lt;cpd minimumTokenCount="100" outputFile="/home/tom/cpd.txt"&gt;
          &lt;fileset dir="/home/tom/tmp/ant"&gt;
              &lt;include name="**/*.java"/&gt;
          &lt;/fileset&gt;
      &lt;/cpd&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>This is how the translation looks currently:</p>
  
  <pre><code>check &lt;&lt; {
          ant.taskdef(name: 'cpd', classname: 'net.sourceforge.pmd.cpd.CPDTask', classpath: configurations.pmd.asPath)
          ant.cpd(minimumTokenCount: '100', outputFile: file('build/reports/pmd/copyPasteDetector.txt').toURI().toString()) {
              fileset(dir: 'src'){
                  include(name: '**.java')
          }
      }
  }
  </code></pre>
  
  <p>Unfortunately calling <code>gradle check</code> yields an <code>net.sourceforge.pmd.cpd.ReportException</code>, the stacktrace is <a href="http://pastebin.com/FB3VeJmY" rel="nofollow">here</a>.</p>
  
  <p>How can I scan my source code with the Copy/Paste Detector using Gradle 1.9?</p>
  
  <p>Thanks!</p>