Single Command to run sonar analysis for Java and Python


I am using SonarQube 7.7 version. I am looking for a single maven command to run sonar analysis with java and python.

My Current approach:

I am able to run sonar analysis with java using below command
mvn clean install sonar:sonar
Note: above command doesn’t analyse any python file.
And I am able to run python analysis with sonar with bellow command
Note: I have extracted the sonar-scanner-cli and set path for bin folder

I want to run sonar analysis with java and python using a single maven command. Can anyone help me on that ?


calling the sonar goal will start analyzing your project. The scope is set via property sonar.sources and sonar.exclusions.
Depending on the languages in the source tree and the installed language scanner plugins on sonarqube server all detected files will be analyzed. If your source tree contains Java and Python sources that are not excluded by sonar.exclusions and your Sonarqube server has Sonar Java and Sonar Python installed they will be analyzed.



@abhirupchatterjee It’s always good to share scan logs, pom.xml and/or so that experienced SonarQube users can identify what’s wrong in your configuration.

I confirm that out of the box, SonarScanner (aka SonarScanner CLI) or the “sonar:sonar” command scan all the languages you have in your project.

Hi Gilbert and Alexandre,
Thank you so much, I was able to run java and python both using the same maven profile. I have added 2 property in order to get python files analyzed, sonar.sources and sonar.language, where as for java and xmls we don’t need to set those two properties.

Hi Abhirup Chatterjee,

Can you please share the property file where you set these properties … i too have similar requirement where i need to include coverage report as well for python … i have a maven project with both java and python source codes … i already setup analysis for java and integrated to sonarqube …Now for the same project i need to include analysis for python as well …if possible please share some pom.xml …you can hide and share if there is any sensitive info in pom.xml…

Thanks In Advance

The parameters have to be added in the properties section of your pom.xml. Here is an example if your Python files are located in src/main/python:


It’s also possible to give them as parameters of your mvn command like:

  mvn sonar:sonar

Does it help?