title: How to correctly configure the property "sonar.java.binaries"?
body: <p>We are using SonarQube 5.1.2 using Ant runner 2.2 and Java pluging 3.12 for the analysis. I can succesfully analyse my project. I just keep getting this error:</p>
  
  <pre><code>Java bytecode has not been made available to the analyzer. The org.sonar.java.bytecode.visitor.DependenciesVisitor@d678716, org.sonar.java.checks.unused.UnusedPrivateMethodCheck@58e28efd, CycleBetweenPackages rule are disabled.
  </code></pre>
  
  <p>So I need to configure my sonar.java.binaries and sonar.java.test.binaries properties (following <a href="http://docs.sonarqube.org/display/PLUG/Java+Plugin+and+Bytecode" rel="noreferrer">http://docs.sonarqube.org/display/PLUG/Java+Plugin+and+Bytecode</a>). </p>
  
  <p>Which I think I have done correctly:</p>
  
  <pre><code>&lt;property name="project.dir" value="${basedir}/xalg.prj/h3_service_fo" /&gt;   
  &lt;property name="sonar.java.binaries" location="${project.build.dir}/classes/main" /&gt;
  &lt;property name="sonar.java.test.binaries" value="${project.build.dir}/classes/test" /&gt;
  </code></pre>
  
  <p>Which resolve to the following valid directories for the above properties:</p>
  
  <pre><code>basedir=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj
  project.dir=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/xalg.prj/h3_service_fo
  sonar.java.binaries=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj\\xalg.prj\\h3_service_fo\\build\\classes\\main
  sonar.java.test.binaries=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/xalg.prj/h3_service_fo/build/classes/test
  </code></pre>
  
  <p>But I keep getting:</p>
  
  <pre><code>Java bytecode has not been made available to the analyzer. The org.sonar.java.bytecode.visitor.DependenciesVisitor@d678716, org.sonar.java.checks.unused.UnusedPrivateMethodCheck@58e28efd, CycleBetweenPackages rule are disabled.
  </code></pre>
  
  <p>And for the life of me, I can not figure out what values I need to give the sonar.java.binaries and sonar.java.test.binaries properties. I even tried using sonar.binaries, which gave me the following output:</p>
  
  <pre><code>Binary dirs: xalg.prj/h3_service_fo/build/classes
  </code></pre>
  
  <p>Which I did not get using either sonar.java.binaries or sonar.java.test.binaries. I also got:</p>
  
  <pre><code>JavaClasspath initialization...
  sonar.binaries and sonar.libraries are deprecated since version 2.5 of sonar-java-plugin, please use sonar.java.binaries and sonar.java.libraries instead
  </code></pre>
  
  <p>Which is to be expected for a deprecated property. But using the sonar.java.binaries property I did not get the "Binary dirs" line in my log.</p>
  
  <p>Using sonar.java.binaries:</p>
  
  <pre><code>Language is forced to java
  Load rules
  Load rules (done) | time=761ms
  Code colorizer, supported languages: cs,plsql
  Initializers : 
  Base dir: D:\appl\BuildAgent\work\H3\src.prj\java.prj
  Working dir: D:\appl\BuildAgent\work\H3\src.prj\java.prj\.sonar
  Source paths: xalg.prj/h3_service_fo/src/main/java
  Test paths: xalg.prj/h3_service_fo/src/test/java
  Source encoding: windows-1252, default locale: en_US
  Index files
  </code></pre>
  
  <p>Versus using sonar.binaries:</p>
  
  <pre><code>Language is forced to java
  Load rules
  Load rules (done) | time=736ms
  Code colorizer, supported languages: cs,plsql
  Initializers : 
  Base dir: D:\appl\BuildAgent\work\H3\src.prj\java.prj
  Working dir: D:\appl\BuildAgent\work\H3\src.prj\java.prj\.sonar
  Source paths: xalg.prj/h3_service_fo/src/main/java
  Test paths: xalg.prj/h3_service_fo/src/test/java
  Binary dirs: xalg.prj/h3_service_fo/build/classes
  Source encoding: windows-1252, default locale: en_US
  Index files
  </code></pre>
  
  <p>I also looked into the source code of SonarQube, SonarQube Java Plugin and the SonarQube Scanner for instances of either "Java bytecode has not been made available to the analyzer." or sonar.java.binaries. I found plenty on sonar.java.binaries, but nothing on "Java bytecode has not been made available to the analyzer." So I have no clue what conditions exactly trigger that error.</p>
  
  <p>I also tried the following permutations on sonar.java.binaries:</p>
  
  <pre><code>&lt;property name="sonar.java.binaries" location="${project.build.dir}/classes" /&gt;
  &lt;property name="sonar.java.binaries" location="${project.build.dir}/classes/main/nl" /&gt;
  </code></pre>
  
  <p>But that did nothing either.</p>
  
  <p>What is weird is that Squid seems to resolve the classpath just fine:</p>
  
  <pre><code>----- Classpath analyzed by Squid:
  D:\appl\BuildAgent\work\H3\src.prj\java.prj\xalg.prj\h3_service_fo\build\classes\main
  </code></pre>
  
  <p>So, what am I missing? What am I doing wrong? Thanks in advance.</p>
  
  <p><strong>Update 2016-09-08</strong>:<br>
  Removed the entire log, the post become to long.</p>
  
  <p>A subset with the (I think) relevant paths:</p>
  
  <pre><code>project.build.dir=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/xalg.prj/h3_service_fo/build
  project.dir=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/xalg.prj/h3_service_fo
  project.src.dir=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/xalg.prj/h3_service_fo/src
  
  sonar.dir=D\:/appl/sonarqube-5.1.2
  sonar.working.directory=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj\\.sonar
  sonar.projectBaseDir=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj
  
  sonar.jacoco.reportPath=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/xalg.prj/h3_service_fo/build/jacoco/test.exec
  sonar.junit.reportsPath=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/xalg.prj/h3_service_fo/build/test-results
  
  sonar.sources=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/xalg.prj/h3_service_fo/src/main/java
  sonar.java.binaries=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj\\xalg.prj\\h3_service_fo\\build\\classes\\main
  
  sonar.java.libraries=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/_deploy/*.jar,D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/_repos/lib/*.jar,D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/_repos/provided/*.jar
  
  sonar.tests=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/xalg.prj/h3_service_fo/src/test/java
  sonar.java.test.binaries=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/xalg.prj/h3_service_fo/build/classes/test
  sonar.java.test.libraries=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/_deploy/*.jar,D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/_repos/lib/*.jar,D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj/_repos/provided/*.jar
  </code></pre>
  
  <p>The paths have exactly the same format as in my post. Could it be that the Sonar Ant runner can't figure out a path with both backslashes and slashes?</p>
  
  <p><strong>Update 2016-09-16</strong>:<br>
  Removed the entire log, the post become to long.</p>
  
  <p>A subset with the (I think) relevant paths:</p>
  
  <pre><code>project.build.dir=xalg.prj\\\\h3_service_fo\\\\build
  project.dir=xalg.prj\\\\h3_service_fo
  project.src.dir=xalg.prj\\\\h3_service_fo\\\\src
  
  sonar.dir=D\:\\\\appl\\\\sonarqube-5.1.2
  sonar.working.directory=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj\\.sonar
  sonar.projectBaseDir=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj
  
  sonar.jacoco.reportPath=xalg.prj\\\\h3_service_fo\\\\build\\\\jacoco/test.exec
  sonar.junit.reportsPath=xalg.prj\\\\h3_service_fo\\\\build\\\\test-results
  
  sonar.sources=xalg.prj\\\\h3_service_fo\\\\src\\\\main\\\\java
  sonar.java.binaries=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj\\xalg.prj\\h3_service_fo\\build\\classes\\main
  sonar.java.libraries=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj\\\\_deploy\\\\*.jar,D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj\\\\_repos\\\\lib\\\\*.jar,D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj\\\\_repos\\\\provided\\\\*.jar
  
  sonar.tests=xalg.prj\\\\h3_service_fo\\\\src\\\\test\\\\java
  sonar.java.test.binaries=xalg.prj\\\\h3_service_fo\\\\build\\\\classes\\\\test
  sonar.java.test.libraries=D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj\\\\_deploy\\\\*.jar,D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj\\\\_repos\\\\lib\\\\*.jar,D\:\\appl\\BuildAgent\\work\\H3\\src.prj\\java.prj\\\\_repos\\\\provided\\\\*.jar
  </code></pre>
  
  <p>Some paths have become relative, but I think that is because TeamCity changed the Ant file to the file in SVN.
  The sonar.java.binaries is absolute and it <strong>definitely</strong> points to the correct directory. </p>
  
  <p>But I still get this error:</p>
  
  <pre><code>09:17:52.299 INFO  - Java Main Files AST scan done: 1579 ms
  09:17:52.301 INFO  - 2/2 source files have been analyzed
  09:17:52.305 WARN  - Java bytecode has not been made available to the analyzer. The org.sonar.java.bytecode.visitor.DependenciesVisitor@757a48f9, org.sonar.java.checks.unused.UnusedPrivateMethodCheck@1adf492b, CycleBetweenPackages rule are disabled.
  </code></pre>
  
  <p>The classpath is still interpreted just fine:</p>
  
  <pre><code>[sonar:sonar] 09:17:51.971 DEBUG - ----- Classpath analyzed by Squid:
  [sonar:sonar] 09:17:51.972 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\xalg.prj\h3_service_fo\build\classes\main
  [sonar:sonar] 09:17:51.973 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\batch.daemon.jar
  [sonar:sonar] 09:17:51.974 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\buildinfo.jar
  [sonar:sonar] 09:17:51.975 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\h2_shared.jar
  [sonar:sonar] 09:17:51.975 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\h3_generator.jar
  [sonar:sonar] 09:17:51.976 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\h3_loadtest.jar
  [sonar:sonar] 09:17:51.977 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\h3_model_common.jar
  [sonar:sonar] 09:17:51.977 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\h3_model_xalg.jar
  [sonar:sonar] 09:17:51.978 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\h3_model_xalg_dao.jar
  [sonar:sonar] 09:17:51.979 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\h3_model_xalg_mappers.jar
  [sonar:sonar] 09:17:51.979 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\h3_model_xalg_procedures.jar
  [sonar:sonar] 09:17:51.980 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\h3_model_xcare.jar
  [sonar:sonar] 09:17:51.981 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\h3_model_xcare_dao.jar
  [sonar:sonar] 09:17:51.982 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\h3_model_xcare_mappers.jar
  [sonar:sonar] 09:17:51.982 DEBUG - D:\appl\BuildAgent\work\H3\src.prj\java.prj\_deploy\h3_model_xcare_procedures.jar
  </code></pre>
  
  <p>Could the Sonar Ant runner have a problem with the escaped back slashes?</p>