title: SonarQube analysis of Java module fails in Jenkins
body: <p>I have created a Jenkins project to run SonarQube analysis of my product code. The workspace contains multiple modules (some in Nodejs i.e. Javascript) and some in Java. My sonar properties looks like</p>
  
  <pre><code>sonar.projectKey=product-key
  sonar.projectName=product-name
  sonar.projectVersion=1.0
  sonar.sources=./nodejsmodule1,./nodejsmodule2
  sonar.sourceEncoding=UTF-8
  </code></pre>
  
  <p>This works perfectly without issue and gives me a nice SonarQube dashboard. However, if I change the <code>sonar.sources</code> property to:</p>
  
  <pre><code>sonar.sources=./nodejsmodule1,./nodejsmodule2,./java-module-name/src/main/java
  </code></pre>
  
  <p>the Jenkins build fails with the following error:</p>
  
  <pre><code>ERROR: Error during Sonar runner execution
  org.sonar.runner.impl.RunnerException: Unable to execute Sonar
  at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
  at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
  at java.security.AccessController.doPrivileged(Native Method)
  at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
  at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
  at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
  at org.sonar.runner.api.Runner.execute(Runner.java:100)
  at org.sonar.runner.Main.executeTask(Main.java:70)
  at org.sonar.runner.Main.execute(Main.java:59)
  at org.sonar.runner.Main.main(Main.java:53)
  Caused by: java.lang.NoSuchMethodError: org.sonar.api.resources.Project.getPom()Lorg/apache/maven/project/MavenProject;
  at org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectoryFromPluginConfiguration(SurefireUtils.java:56)
  at org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectory(SurefireUtils.java:39)
  at org.sonar.plugins.surefire.SurefireSensor.analyse(SurefireSensor.java:63)
  at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
  at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
  at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:98)
  at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
  at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)
  at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
  at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:258)
  at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:253)
  at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:243)
  at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)
  at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
  at org.sonar.batch.bootstrap.GlobalContainer.executeAnalysis(GlobalContainer.java:153)
  at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:110)
  at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:76)
  at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
  ... 9 more
  </code></pre>
  
  <p>When I use</p>
  
  <pre><code>sonar.sources=./nodejsmodule1,./nodejsmodule2,./java-module-name/pom.xml
  </code></pre>
  
  <p>The error goes away. The multi-language analysis happens. The events widget on the SonarQube dashboard for the project shows that Java and JavaScript profiles got used during the analysis. But the code analysis results don't contain anything about Java. JavaScript analysis results show up. Doesn't matter in which order I specify the <code>sonar.sources</code> values (i.e. JavaScript followed by Java or Java followed by JavaScript). I looked at other StackOverflow questions (e.g. <a href="https://stackoverflow.com/questions/23915270/sonar-analysing-maven-3-and-multi-language-project-using-jenkins">Sonar analysing Maven 3 and multi language project using JENKINS</a>). Clearly, they are specifying the location of the classes file as well. Maybe the java code is getting compiled during the Jenkins build step for SonarQube analysis so they can point to the <code>target/classes</code> location. When I try this (i.e. <code>sonar.binaries=./java-module-name/target/classes</code>), the build fails. </p>
  
  <p>Based on <a href="http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+Maven#AnalyzingwithSonarQubeScannerforMaven-AnalyzingaMulti-languageProject" rel="nofollow noreferrer">http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+Maven#AnalyzingwithSonarQubeScannerforMaven-AnalyzingaMulti-languageProject</a>, I also tried <code>sonar.sources=./java-module-name/src,./java-module-name/pom.xml</code>. But that brings back the exception. The exception also happens for <code>sonar.sources=./java-module-name,./java-module-name/pom.xml</code>, <code>sonar.sources=./java-module-name/src/main,./java-module-name/pom.xml</code> and <code>sonar.sources=./java-module-name/src/main/java,./java-module-name/pom.xml</code>.</p>
  
  <p>What am I doing wrong?</p>