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?
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.
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.
The property to be declared for SonarQube Project base dir is sonar.
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.
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,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With