SonarQube Java version used to verify code

The default value is 1.5.

To set the appropriate version, you need to set sonar.java.source property to tell PMD which version of Java your source code complies to.

Possible values: 1.4, 1.5 or 5, 1.6 or 6, 1.7 or 7. Since version 2.2 of the plugin, this property can also be set to 1.8 or 8.

If you're using the ant task, just add:

 <property name="sonar.java.source" value="${javaversion}"/> 

If you're using the SonarRunner, just add the line below to the file <install_directory>/conf/sonar-runner.properties:

sonar.java.source=1.5

I do confirm that this property sonar.java.source is used only by the PMD tool. The SonarSource's Java analyser uses a superset grammar and so can analyse source files regardless of the Java version they comply to.

Tags:

Java

Sonarqube