0
votes

During installation of sonar scanner I am getting error like:

"E:\Heena\Software\sonar-scanner\bin..
INFO: Scanner configuration file: E:\Heena\Software\sonar-scanner\bin..\conf\so nar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.8
INFO: Java 1.8.0_101 Oracle Corporation (64-bit)
INFO: Windows 7 6.1 amd64
INFO: User cache: C:\Users\ADMIN.sonar\cache
INFO: Load global repositories
INFO: Load global repositories (done) | time=779ms INFO: User cache: C:\Users\ADMIN.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=35ms
INFO: SonarQube server 5.6.3
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Process project properties
INFO: ------------------------------------------------------------------------ INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------ INFO: Total time: 11.028s
INFO: Final Memory: 39M/84M
INFO: ------------------------------------------------------------------------ ERROR: Error during SonarQube Scanner execution
ERROR: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging . E:\Heena\Software\sonar-scanner\bin>"

If anyone know about that error kindly help me. Please note that I am using windows 7 os.

2
Is this a git question?JARO
Nope, it was regarding running sonarscanner. it is done. but the confusion is, when I put all folder regarding sonarqube in c: it will work and when I tried from another directory its through above erroeHeena Patel

2 Answers

2
votes

Looking at the log message:

ERROR: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources

It seems analysis should be launched with something like this:

> sonar-runner -Dsonar.projectKey=myProjectKey -Dsonar.projectName="My Project" -Dsonar.projectVersion=1 -Dsonar.sources=.

More information here: Analysis Parameters - SonarQube Documentation - SonarQube

And here: Analyzing with SonarQube Scanner - Scanners - SonarQube

1
votes

I see two problems in your case.

  • A. You are running sonar-scanner from the sonar-scanner install
    folder. (E:\Heena\Software\sonar-scanner\bin).
  • B. You have not configured the mandatory project properties for sonar-scanner to execute.

Following are the typical steps you can follow here.

  1. Add sonar-scanner install folder (E:\Heena\Software\sonar-scanner\bin in your case) to system PATH.
  2. Go to the Project root folder and the properties file sonar-project.properties. The sonar-project.properties file should have mandatory properties defined.
  3. The four mandatory properties are sonar.projectKey, sonar.projectName, sonar.projectVersion and sonar.sources
  4. Run sonar-scanner from the project root folder.

Refer the attached screen shot here enter image description here