Because the company's wall is too high, I can not blow open, unable to use Gradle, so I still obediently use Sonar-runner to generate code quality data bar.
Download
The resources found on the CSDN.
After decompression, the file directory structure
Configuration
Then configure the environment variables, enter Sonar-runner under CMD, and the following information indicates that the configuration is correct
C:\users\hui.qian>sonar-runner-h
D:\sonar\sonar-runner-2.4
INFO:
Info:usage:sonar-runner [ Options]
Info:
info:options:
info:-D,--define <arg> define Property
INFO:-E,--errors Produce execution error Messages
info:-h,--help Display Help information
INFO:-V,--version Display version Information
INFO:-x,--debug produce execution debug output
Locate the Conf/sonar-runner.properties file in the Sonar-runner directory. Turn on MySQL configuration
#Configure Here general information on the environment, such as SonarQube DB details for example
#No information AB Out specific project should appear here
#-----Default SonarQube Server
sonar.host.url=http://localhost:9002
#-----PostgreSQL
#sonar. Jdbc.url=jdbc:postgresql://localhost/sonar
#-----MySQL
Sonar.jdbc.url =jdbc:mysql://localhost:3306/sonar?useunicode=true&characterencoding=utf8
#-----Oracle
# Sonar.jdbc.url=jdbc:oracle:thin: @localhost/xe
#-----Microsoft SQL Server
#sonar. Jdbc.url=jdbc:jtds: Sqlserver://localhost/sonar; Selectmethod=cursor
#-----Global Database Settings
sonar.jdbc.username=sonar
sonar.jdbc.password= Sonar
#-----Default Source code encoding
sonar.sourceencoding=utf-8
#-----Security (When ' Sonar.forceauthentication ' is set to ' true ')
sonar.login=admin
sonar.password=admin
OK, above about Sonar-runner all configuration complete
Start the sonar server
Click Startsonar.bat to start the sonar server:
Target Project
I choose a project that I am working on, and then add a sonar profile sonar-project.properties under the project root directory. The information in the configuration file is as follows:
Sonar-project.properties
Sonar.projectkey=as
sonar.projectname=as
sonar.projectversion=1.0
sonar.sources=src
binaries= Bin
However, the error is as follows:
caused By:java.lang.IllegalStateException:The svn blame command [svn blame--x
ml--non-interactive-x-W src/com/sp Rd/scenario/test/asdevicemanagertest.java]
failed:svn:warning:W155010:The node ' D:\as\src\com\sprd\scenario\ Test\asdevi
Cemanagertest.java ' is not found.
Svn:E200009:Could not perform blame on all targets because some targets don ' t
exist
Because I didn't commit the class to SVN, did it go to SVN to find the code? So weird ... after committing to SVN, it's done.
Report
This time we visit http://localhost:9002/to see the code quality of the project