title: Sonar Maven Plugin: How do I exclude test source directories?
body: <p>I have a Maven project with Java sources and Scala test sources. I generate code coverage using <code>Jacoco</code> during the <code>verify</code> stage. When I try to run the sonar goal either during the verify phase by adding an execution, or by running <code>mvn verify sonar:sonar</code>, I end up with the test directory being added twice by Sonar:</p>
  
  <pre><code>  [INFO] [11:15:34.756] Test directories:
    [INFO] [11:15:34.756]   /Users/xxx/Documents/workspace/misc/xxx/src/test/scala
    [INFO] [11:15:34.756]   /Users/xxx/Documents/workspace/misc/xxx/src/test/scala/../scala
  </code></pre>
  
  <p>which results in the analysis failing with the following error:</p>
  
  <pre><code>Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.1:sonar (default-cli) on project kv-mapper: Can not execute SonarQube analysis: Unable to read and import the source file : '/Users/xxxx/Documents/workspace/misc/xxx/src/test/scala/../scala/xxx/xxxxx/xxx/xxx/xxxxx/xxxxxx.java' with the charset : 'UTF-8'. Duplicate source for resource
  </code></pre>
  
  <p>My pom.xml (for Sonar) looks like this.</p>
  
  <pre><code>    &lt;plugin&gt;
          &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
          &lt;artifactId&gt;sonar-maven-plugin&lt;/artifactId&gt;
          &lt;version&gt;${sonar.plugin.version}&lt;/version&gt;
          &lt;!-- no default executions --&gt;
          &lt;configuration&gt;
              &lt;sonar.core.codeCoveragePlugin&gt;jacoco&lt;/sonar.core.codeCoveragePlugin&gt;
              &lt;sonar.dynamicAnalysis&gt;reuseReports&lt;/sonar.dynamicAnalysis&gt;
              &lt;sonar.language&gt;java&lt;/sonar.language&gt;
              &lt;sonar.jacoco.itReportPath&gt;
                  ${basedir}/target/jacoco.exec
              &lt;/sonar.jacoco.itReportPath&gt;
              &lt;sonar.exclusions&gt;
                  **/test/*
              &lt;/sonar.exclusions&gt;
          &lt;/configuration&gt;
      &lt;/plugin&gt;
  </code></pre>
  
  <p>How do I configure Sonar to either:</p>
  
  <ul>
  <li>exclude test/scala directory entirely?
  or</li>
  <li>remove the duplicate directory?</li>
  </ul>