Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daipresents/75060fcc156eeb80d424167ce77809d5 to your computer and use it in GitHub Desktop.
Save daipresents/75060fcc156eeb80d424167ce77809d5 to your computer and use it in GitHub Desktop.
SonarQube sample
# SonarQubeを以下に解凍
C:\sonarqube
# SonarQube実行
C:\sonarqube\bin\windows-x86-64\StartSonar.bat
# SonarQube Scannerを以下に解凍
C:\sonar-scanner
# 解析するディレクトリを以下に解凍
C:\spring-boot-master
# 解析するディレクトリに移動してScanner実行
>cd C:\spring-boot-master
>C:\sonar-scanner\bin\sonar-scanner.bat
INFO: Scanner configuration file: C:\sonar-scanner\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.6
INFO: Java 1.8.0_25 Oracle Corporation (64-bit)
INFO: Windows 7 6.1 amd64
INFO: User cache: C:\Users\daipresents\.sonar\cache
INFO: Load global repositories
INFO: Load global repositories (done) | time=131ms
INFO: User cache: C:\Users\daipresents\.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=15ms
INFO: SonarQube server 5.4
INFO: Default locale: "en_US", source code encoding: "windows-31j" (analysis is platform dependent)
INFO: Process project properties
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2.035s
INFO: Final Memory: 39M/155M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to load component class org.sonar.batch.scan.ProjectLock
ERROR: Caused by: Unable to load component class org.sonar.api.batch.bootstrap.ProjectReactor
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 Scanner with the -e switch.
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
# propertiesファイル更新
C:\sonar-scanner\conf\sonar-scanner.properties
#Configure here general information about the environment, such as SonarQube DB details for example
#No information about specific project should appear here
#----- Default SonarQube server
sonar.host.url=http://localhost:9000
#----- Default source code encoding
sonar.sourceEncoding=UTF-8
# The project key that is unique for each project.
# When using Maven, it is automatically set to <groupId>:<artifactId>
sonar.projectKey=org.springframework.boot:spring-boot-build
# Name of the project that will be displayed on the web interface.
# Set through <name> when using Maven.
sonar.projectName=Spring Boot Build
# The project version.
# Set through <version> when using Maven.
sonar.projectVersion=1.4.0.BUILD-SNAPSHOT
# Comma-separated paths to directories containing source files.
# Compatible with Maven. If not set, the source code is retrieved from the default Maven source code location.
sonar.sources=./spring-boot/src, ./spring-boot-actuator/src, ./spring-boot-autoconfigure/src, ./spring-boot-cli/src, ./spring-boot-dependencies/src, ./spring-boot-devtools/src, ./spring-boot-parent/src, ./spring-boot-starters/src, ./spring-boot-test/src, ./spring-boot-test-autoconfigure/src
>C:\sonar-scanner\bin\sonar-scanner.bat
INFO: Scanner configuration file: C:\sonar-scanner\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.6
INFO: Java 1.8.0_25 Oracle Corporation (64-bit)
・・・
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/org.springframework.boot:spring-boot-build
INFO: Note that you will be able to access the updated dashboard once the server has processed the s
ubmitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=XXXXXXXXXX
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 29.115s
INFO: Final Memory: 58M/775M
INFO: ------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment