Search code examples
sonarqubesonar-runner

Change java source version for multiple project using same sonar scanner


I have 3 different projects. One of them is based on java 1.6 and the others are using java 8 features. I have sonar-scanner locally and running the analysis by using scripts (no Maven or Gradle is being used). I have configured the sonar.java.source to be 1.6.

My problem is that same runner is being used to analyze the other 2 projects (java 8 ones). How can I change the version of the java source for the other ones? I don't want to manually change it each time I want to run the runner. Can I somehow pass it as parameter?


Solution

  • Source version is not a property of the scanner, but of the projects. Configure these values in your pom, or your sonar-project.properties files, or in the command line arguments (-Dsonar.java.source=1.x), but not in the SonarQube Scanner properties.