“This is the 11th day of my participation in the Gwen Challenge in November. See details: The Last Gwen Challenge in 2021”

directory

  • preface
  • The body of the
    • ERROR: Not authorized. Please check the properties sonar. Login and sonar.
    • SCM provider autodetection failed. Both SVN and git claim to support this project. Please use sonar define SCM of your project.
    • ERROR: Not inside a Git work tree
  • At the end

preface

Sonar is an open source platform and tool for managing source code quality. Sonar is not only a quality data reporting tool, but also code quality management platform. It supports a wide range of languages, including the usual Java, PHP, C#, C, Golang, JS, etc. In the process of installation, deployment and use will often encounter a variety of problems, today simply comb through a few of their own problems.

The body of the

ERROR: Not authorized. Please check the properties sonar. Login and sonar.

The general project management interface will provide an example of executing the command, as shown in the following figure:

After we modify the path and key, we execute the sample command and an error occurs (I knew it wasn’t that simple). The error details are as follows:

INFO: Scanner configuration file: G: project\LLL\sonar- Scanner -4.6.2.2472- Windows \bin.. \conf\sonar-scanner.properties INFO: Project root configuration file: NONE INFO: SonarScanner 4.6.2.2472 INFO: Java 11.0.11 AdoptOpenJDK (64-bit) INFO: Windows 10 10.0 AMd64 INFO: User Cache: C:\Users\ PC.SONAR \cache INFO: Scanner configuration file: G: \ project \ name ‘LLL \ sonar – Scanner – 4.6.2.2472 – Windows \ bin. \conf\sonar-scanner.properties INFO: Project root configuration file: NONE INFO: Analyzing on SonarQube Server 9.1.0 INFO: Default locale: “zh_CN”, source code encoding: “GBK” (analysis is platform dependent) INFO: Load global settings INFO: ———————————————————————— INFO: EXECUTION FAILURE INFO: — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — the INFO: Total time: 11.837 s INFO: Final Memory: 5M/20M INFO: ———————————————————————— ERROR: Error during SonarScanner execution ERROR: Not authorized. Please check the properties sonar.login and sonar.password. ERROR: ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Error screenshot:

Solution:

-d “sonar. Password =123456”

sonar-scanner.bat -D”sonar.projectKey=bag” -D”sonar.sources=G:\project\LLL\bag” -D”sonar.host.url=sonar.lozen.com” -D”sonar.login=lozen”  -D”sonar.password=123456″

Execution Result:

INFO: More about the report processing at sonar.lozen.com/api/ce/task… INFO: the Analysis of total time: 4.726 s INFO: — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — the INFO: EXECUTION SUCCESS INFO: ———————————————————————— INFO: Total time: INFO: 55.062 s Final Memory: 8 m / 30 m INFO: — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Well, the problem here has been solved.

SCM provider autodetection failed. Both SVN and git claim to support this project. Please use sonar define SCM of your project.

Once the above problem was resolved, we went back to the project management page to view the execution results and found this error message.

Solution:

Add -d “sonary.scm. provider=git” to the command as follows:

sonar-scanner.bat -D”sonar.projectKey=bag” -D”sonar.sources=G:\project\LLL\bag” -D”sonar.host.url=sonar.lozen.com” -D”sonar.login=lozen” -D”sonar.password=123456″ -D”sonar.scm.provider=git”

ERROR: Not inside a Git work tree

The above problem solved, and this report error, is really stepped over a pit and a pit, pit is waiting for you.

Error message:

INFO: Indexing files… INFO: Project configuration: INFO: ———————————————————————— INFO: EXECUTION FAILURE INFO: ———————————————————————— INFO: Total time: INFO: 6.411 s Final Memory: 7 m / 24 m INFO: — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — the ERROR: Error during SonarScanner execution ERROR: Not inside a Git work tree: G: \ project \ name ‘LLL \ sonar – scanner – 4.6.2.2472 – Windows \ bin ERROR: ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Error screenshot:

Solution: the error message is very clear, we need to put the tool directory into the specified project to run the command, the problem is solved.

The final result can be seen behind sonar with the following message:

However, the lower left corner of the screenshot indicates that the main branch of the project is empty, which makes me very upset. Obviously, it is not empty, so it seems that we need to continue the investigation. Let’s put this part into the next phase.

At the end

Sonar is indeed a good tool, but there are many problems, today on the use of sonar encountered problems on the introduction of so much, good night.

About the author: Hello, everyone, I am Liuzhen007, an audio and video technology fan, CSDN blog expert, Huawei Cloud community cloud sharing expert, signed the author, welcome to follow me to share more dry products!