Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonar Setup Undefined Mandatory Properties

Learning how to use SonarQube and was doing a quick install from here

Got all the way down to step 5. My build fails when I execute: C:\sonar-runner\bin\sonar-runner.bat

I get the following error:

INFO: ------------------------------------------------------------------------ INFO: EXECUTION FAILURE INFO: ------------------------------------------------------------------------ Total time: 7.572s Final Memory: 8M/223M INFO: ------------------------------------------------------------------------ ERROR: Error during Sonar runner execution ERROR: Unable to execute Sonar ERROR: Caused by: You must define the following mandatory properties for 'Unknown':   sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources ERROR: ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch. ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging. 

Anyone encountered a similar situation and resolved?

like image 790
SeekingAlpha Avatar asked Jan 18 '14 12:01

SeekingAlpha


People also ask

Where do I put sonar project properties?

Inside your “sonarqube-scanner” folder, go to “conf” folder and find “sonar-scanner. properties” file. Open it in edit mode. Add these two basic properties in “sonar-scanner.

What is the mandatory parameter for project analysis in SonarQube?

Mandatory ParametersThe project's unique key. Allowed characters are: letters, numbers, - , _ , . and : , with at least one non-digit. Comma-separated paths to directories containing source files.

Which property should be declared for SonarQube project base dir?

The property to be declared for SonarQube Project base dir is sonar.

What is Sonar projectKey?

projectKey is simply the unique identifier of your project inside SonarQube. You are free to choose whatever you want, as long as it is unique. Analysis Parameters is the official documentation page from Sonar, where you can find additional information about all the properties.


1 Answers

If you have a java project, you must create a sonar-project.properties file in the folder where you execute sonar runner. You must define the following properties inside this file:

# Required metadata sonar.projectKey=java-sonar-runner-simple sonar.projectName=Simple Java project analyzed with the SonarQube Runner sonar.projectVersion=1.0  # Comma-separated paths to directories with sources (required) sonar.sources=src  # Language sonar.language=java  # Encoding of the source files sonar.sourceEncoding=UTF-8 

Hope this helps,

like image 79
albciff Avatar answered Sep 30 '22 06:09

albciff