SONAR下載下傳位址: https://www.sonarqube.org/downloads/ (本文版本:sonarqube-6.3)
下載下傳完解壓出來
根據你的電腦系統進到bin後的系統目錄 (本文機器,64位WIN7)
用CMD指令進入 E:\Program File\sonarqube-6.3\bin\windows-x86-64後執行 StartSonar.bat
E:\Program File\sonarqube-6.3\bin\windows-x86-64>StartSonar.bat
wrapper | --> Wrapper Started as Console
wrapper | Launching a JVM...
jvm 1 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
jvm 1 |
jvm 1 | WrapperSimpleApp: Unable to locate the class org.sonar.application.App: java.lang.UnsupportedClassVersionError: org/sonar/application/App : Unsupport
ed major.minor version 52.0
jvm 1 |
jvm 1 | WrapperSimpleApp Usage:
jvm 1 | java org.tanukisoftware.wrapper.WrapperSimpleApp {app_class} [app_arguments]
jvm 1 |
jvm 1 | Where:
jvm 1 | app_class: The fully qualified class name of the application to run.
jvm 1 | app_arguments: The arguments that would normally be passed to the
jvm 1 | application.
wrapper | <-- Wrapper Stopped
請按任意鍵繼續. . .
這種錯誤是因為JDK版本過低的問題,sonarqube-6.3需要JDK1.8+,是以電腦組態JDK1.8後,重新運作即可
在運作前先建立一個資料庫
在此我命名為sonar
接下來修改
conf/sonar.properties檔案,主要添加資料庫資訊
sonar.jdbc.username=
sonar.jdbc.password=
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
如果沒有配置好資料庫則運作時會出現以下錯誤
E:\Program File\sonarqube-6.3\bin\windows-x86-64>StartSonar.bat
wrapper | --> Wrapper Started as Console
wrapper | Launching a JVM...
jvm 1 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
jvm 1 |
jvm 1 | 2017.08.25 15:48:52 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory E:\Program File\sonarqube-6.3\temp
jvm 1 | 2017.08.25 15:48:53 INFO app[][o.s.p.m.JavaProcessLauncher] Launch process[es]: E:\software\java\jdk1.8.0_121\jre\bin\java -Djava.awt.headless=true
-Xmx1G -Xms256m -Xss256k -Djna.nosys=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:
+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=E:\Program File\sonarqube-6.3\temp -javaagent:E:\software\java\jdk1.8.0_121\jre\lib\management-agent.jar -cp ./lib/
common/*;./lib/search/* org.sonar.search.SearchServer E:\Program File\sonarqube-6.3\temp\sq-process1206689812975548668properties
jvm 1 | 2017.08.25 15:49:05 INFO app[][o.s.p.m.Monitor] Process[es] is up
jvm 1 | 2017.08.25 15:49:05 INFO app[][o.s.p.m.JavaProcessLauncher] Launch process[web]: E:\software\java\jdk1.8.0_121\jre\bin\java -Djava.awt.headless=true
-Dfile.encoding=UTF-8 -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=E:\Program File\sonarqube-6.3\temp -javaagent:E:\software\java\jdk1.8.
0_121\jre\lib\management-agent.jar -cp ./lib/common/*;./lib/server/*;E:\Program File\sonarqube-6.3\lib\jdbc\mysql\mysql-connector-java-5.1.39.jar org.sonar.serv
er.app.WebServer E:\Program File\sonarqube-6.3\temp\sq-process3901561166471593448properties
jvm 1 | Fri Aug 25 15:49:10 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+,
5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using
SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide t
ruststore for server certificate verification.
jvm 1 | 2017.08.25 15:49:12 INFO app[][o.s.p.m.Monitor] Process[es] is stopping
jvm 1 | 2017.08.25 15:49:12 ERROR app[][o.s.p.m.Monitor] Process[web] failed to start
jvm 1 | 2017.08.25 15:49:13 INFO app[][o.s.p.m.Monitor] Process[es] is stopped
wrapper | <-- Wrapper Stopped
弄好資料庫配置後重新運作
我們可以看到腳本會往SONAR這個庫建立很多表及自動插入一些資料
執行成功的日志如下
E:\Program File\sonarqube-6.3\bin\windows-x86-64>StartSonar.bat
wrapper | --> Wrapper Started as Console
wrapper | Launching a JVM...
jvm 1 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
jvm 1 |
jvm 1 | 2017.08.25 15:50:42 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory E:\Program File\sonarqube-6.3\temp
jvm 1 | 2017.08.25 15:50:42 INFO app[][o.s.p.m.JavaProcessLauncher] Launch process[es]: E:\software\java\jdk1.8.0_121\jre\bin\java -Djava.awt.headless=true
-Xmx1G -Xms256m -Xss256k -Djna.nosys=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:
+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=E:\Program File\sonarqube-6.3\temp -javaagent:E:\software\java\jdk1.8.0_121\jre\lib\management-agent.jar -cp ./lib/
common/*;./lib/search/* org.sonar.search.SearchServer E:\Program File\sonarqube-6.3\temp\sq-process1379441345670336396properties
jvm 1 | 2017.08.25 15:50:53 INFO app[][o.s.p.m.Monitor] Process[es] is up
jvm 1 | 2017.08.25 15:50:53 INFO app[][o.s.p.m.JavaProcessLauncher] Launch process[web]: E:\software\java\jdk1.8.0_121\jre\bin\java -Djava.awt.headless=true
-Dfile.encoding=UTF-8 -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=E:\Program File\sonarqube-6.3\temp -javaagent:E:\software\java\jdk1.8.
0_121\jre\lib\management-agent.jar -cp ./lib/common/*;./lib/server/*;E:\Program File\sonarqube-6.3\lib\jdbc\mysql\mysql-connector-java-5.1.39.jar org.sonar.serv
er.app.WebServer E:\Program File\sonarqube-6.3\temp\sq-process8409360607056740017properties
jvm 1 | Fri Aug 25 15:50:57 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+,
5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using
SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide t
ruststore for server certificate verification.
jvm 1 | Fri Aug 25 15:50:57 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+,
5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using
SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide t
ruststore for server certificate verification.
jvm 1 | Fri Aug 25 15:51:06 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+,
5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using
SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide t
ruststore for server certificate verification.
jvm 1 | Fri Aug 25 15:51:27 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+,
5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using
SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide t
ruststore for server certificate verification.
jvm 1 | 2017.08.25 15:51:33 INFO app[][o.s.p.m.Monitor] Process[web] is up
jvm 1 | 2017.08.25 15:51:33 INFO app[][o.s.p.m.JavaProcessLauncher] Launch process[ce]: E:\software\java\jdk1.8.0_121\jre\bin\java -Djava.awt.headless=true
-Dfile.encoding=UTF-8 -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=E:\Program File\sonarqube-6.3\temp -javaagent:E:\software\java\jdk1.8.0
_121\jre\lib\management-agent.jar -cp ./lib/common/*;./lib/server/*;./lib/ce/*;E:\Program File\sonarqube-6.3\lib\jdbc\mysql\mysql-connector-java-5.1.39.jar org.
sonar.ce.app.CeServer E:\Program File\sonarqube-6.3\temp\sq-process3449682494564184520properties
jvm 1 | Fri Aug 25 15:51:37 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+,
5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using
SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide t
ruststore for server certificate verification.
jvm 1 | Fri Aug 25 15:51:37 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+,
5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using
SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide t
ruststore for server certificate verification.
jvm 1 | 2017.08.25 15:51:41 INFO app[][o.s.p.m.Monitor] Process[ce] is up
jvm 1 | 2017.08.25 15:51:41 INFO app[][o.s.application.App] SonarQube is up
jvm 1 | Fri Aug 25 15:52:07 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+,
5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using
SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide t
ruststore for server certificate verification.
看到最後出現紅色字型就說明SONAR啟動成功了,我們測試一下
在浏覽器輸入http://localhost:9000
說明啟動成功,登陸的話預設賬号有admin/admin (使用者資訊儲存在資料庫表users)