kubernetes實踐之三十: SonarQube和SonarQube Runner

百聯達發表於2018-05-05
一:簡介
Sonar 是一個用於程式碼質量管理的開放平臺。透過外掛機制,Sonar 可以整合不同的測試工具,程式碼分析工具,以及持續整合工具。比如pmd-cpd、checkstyle、findbugs、Jenkins。透過不同的外掛對這些結果進行再加工處理,透過量化的方式度量程式碼質量的變化,從而可以方便地對不同規模和種類的工程進行程式碼質量管理。同時 Sonar 還對大量的持續整合工具提供了介面支援,可以很方便地在持續整合中使用 Sonar。
此外,Sonar 的外掛還可以對 Java 以外的其他程式語言(支援的語言包括:Java、PHP、C#、C、Cobol、PL/SQL、Flex等)提供支援,對國際化以及報告文件化也有良好的支援。可以說Sonar是目前最強大的程式碼質量管理工具之一。

SonarQube框架包含以下四個部分:
Project: 是需要被分析的原始碼,如我們的app工程原始碼,SonarQube支援多種語言和多種工程結構.
SonarQube Scanner:是用於執行程式碼分析的工具,在Project的根目錄下執行.

SonarQube支援多種工程構建方式的配置,也對應需要用不同的Scanner來執行分析過程:

  • Ant
  • Maven
  • MSBuild(Microsoft Build Engine)
  • Gradle
  • Sonar Runner
SonarQube Server:顯示分析結果的Web Server,在SonarQube Scanner第一次將一個工程的分析結果上報給SonarQube Server後,Server上會自動建立一個工程顯示分析的結果,可以在Server上設定程式碼質量管理相關的各種配置,如設定程式碼檢查規則(Rule)和質量門限(Quality Gate)等。 
SonarQube Database:  支援MySql,Oracle等

二:安裝與配置

1.相關資訊
作業系統:Centos 7.0   
軟體版本:sonarqube-6.7.3.zip   sonar-runner-dist-2.4.zip

2.前置條件
jdk1.8, mysql 5.6(必須是5.6以上版本)

3.解壓縮sonarqube-6.7.3.zip   sonar-runner-dist-2.4.zip 到/usr/local
unzip 
 sonarqube-6.7.3.zip -d /usr/local
unzip  sonar-runner-dist-2.4.zip -d /usr/local

4.環境變數設定

vi  /etc/profile

點選(此處)摺疊或開啟

  1. JAVA_HOME=/usr/local/jdk1.8
  2. export SONAR_HOME=/usr/local/sonarqube-6.7.3
  3. export SONAR_RUNNER_HOME=/usr/local/sonar-runner-2.4
  4. PATH=$JAVA_HOME/bin:$SONAR_HOME/bin:$SONAR_RUNNER_HOME/bin:$PATH
  5. CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
  6. export JAVA_HOME PATH CLASSPATH
source /etc/profile

5.配置sonar.properties(/usr/local/sonarqube-6.7.3/conf/

點選(此處)摺疊或開啟

  1. # Property values can:
  2. # - reference an environment variable, for example sonar.jdbc.url= ${env:SONAR_JDBC_URL}
  3. # - be encrypted. See https://redirect.sonarsource.com/doc/settings-encryption.html

  4. #--------------------------------------------------------------------------------------------------
  5. # DATABASE
  6. #
  7. # IMPORTANT:
  8. # - The embedded H2 database is used by default. It is recommended for tests but not for
  9. # production use. Supported databases are MySQL, Oracle, PostgreSQL and Microsoft SQLServer.
  10. # - Changes to database connection URL (sonar.jdbc.url) can affect SonarSource licensed products.

  11. # User credentials.
  12. # Permissions to create tables, indices and triggers must be granted to JDBC user.
  13. # The schema must be created first.
  14. sonar.jdbc.username=root
  15. sonar.jdbc.password=password

  16. #----- Embedded Database (default)
  17. # H2 embedded database server listening port, defaults to 9092
  18. #sonar.embeddedDatabase.port=9092

  19. #----- MySQL 5.6 or greater
  20. # Only InnoDB storage engine is supported (not myISAM).
  21. # Only the bundled driver is supported. It can not be changed.
  22. sonar.jdbc.url=jdbc:mysql://112.74.53.213:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false


  23. #----- Oracle 11g/12c
  24. # The Oracle JDBC driver must be copied into the directory extensions/jdbc-driver/oracle/.
  25. # Only the thin client is supported, and only the versions 11.2.x or 12.2.x must be used. See
  26. # https://jira.sonarsource.com/browse/SONAR-9758 for more details.
  27. # If you need to set the schema, please refer to http://jira.sonarsource.com/browse/SONAR-5000
  28. #sonar.jdbc.url=jdbc:oracle:thin:@localhost:1521/XE


  29. #----- PostgreSQL 8.x or greater
  30. # If you don't use the schema named "public", please refer to
  31. #sonar.jdbc.url=jdbc:postgresql://localhost/sonar


  32. #----- Microsoft SQLServer 2014/2016 and SQL Azure
  33. # A database named sonar must exist and its collation must be case-sensitive (CS) and accent-sensitive (AS)
  34. # Use the following connection string if you want to use integrated security with Microsoft Sql Server
  35. # Do not set sonar.jdbc.username or sonar.jdbc.password property if you are using Integrated Security
  36. # For Integrated Security to work, you have to download the Microsoft SQL JDBC driver package from
  37. #
  38. # and copy sqljdbc_auth.dll to your path. You have to copy the 32 bit or 64 bit version of the dll
  39. # depending upon the architecture of your server machine.
  40. #sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar;integratedSecurity=true

  41. # Use the following connection string if you want to use SQL Auth while connecting to MS Sql Server.
  42. # Set the sonar.jdbc.username and sonar.jdbc.password appropriately.
  43. #sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar


  44. #----- Connection pool settings
  45. # The maximum number of active connections that can be allocated
  46. # at the same time, or negative for no limit.
  47. # The recommended value is 1.2 * max sizes of HTTP pools. For example if HTTP ports are
  48. # enabled with default sizes (50, see property sonar.web.http.maxThreads)
  49. # then sonar.jdbc.maxActive should be 1.2 * 50 = 60.
  50. #sonar.jdbc.maxActive=60

  51. # The maximum number of connections that can remain idle in the
  52. # pool, without extra ones being released, or negative for no limit.
  53. #sonar.jdbc.maxIdle=5

  54. # The minimum number of connections that can remain idle in the pool,
  55. # without extra ones being created, or zero to create none.
  56. #sonar.jdbc.minIdle=2

  57. # The maximum number of milliseconds that the pool will wait (when there
  58. # are no available connections) for a connection to be returned before
  59. # throwing an exception, or <= 0 to wait indefinitely.
  60. #sonar.jdbc.maxWait=5000

  61. #sonar.jdbc.minEvictableIdleTimeMillis=600000
  62. #sonar.jdbc.timeBetweenEvictionRunsMillis=30000



  63. #--------------------------------------------------------------------------------------------------
  64. # WEB SERVER
  65. # Web server is executed in a dedicated Java process. By default heap size is 512Mb.
  66. # Use the following property to customize JVM options.
  67. # Recommendations:
  68. #
  69. # The HotSpot Server VM is recommended. The property -server should be added if server mode
  70. # is not enabled by default on your environment:
  71. #
  72. #
  73. # Startup can be long if entropy source is short of entropy. Adding
  74. # -Djava.security.egd=file:/dev/./urandom is an option to resolve the problem.
  75. # See
  76. #
  77. sonar.web.javaOpts=-Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError

  78. # Same as previous property, but allows to not repeat all other settings like -Xmx
  79. #sonar.web.javaAdditionalOpts=

  80. # Binding IP address. For servers with more than one IP address, this property specifies which
  81. # address will be used for listening on the specified ports.
  82. # By default, ports will be used on all IP addresses associated with the server.
  83. sonar.web.host=0.0.0.0

  84. # Web context. When set, it must start with forward slash (for example /sonarqube).
  85. # The default value is root context (empty value).
  86. #sonar.web.context=
  87. # TCP port for incoming HTTP connections. Default value is 9000.
  88. sonar.web.port=9000


  89. # The maximum number of connections that the server will accept and process at any given time.
  90. # When this number has been reached, the server will not accept any more connections until
  91. # the number of connections falls below this value. The operating system may still accept connections
  92. # based on the sonar.web.connections.acceptCount property. The default value is 50.
  93. #sonar.web.http.maxThreads=50

  94. # The minimum number of threads always kept running. The default value is 5.
  95. #sonar.web.http.minThreads=5

  96. # The maximum queue length for incoming connection requests when all possible request processing
  97. # threads are in use. Any requests received when the queue is full will be refused.
  98. # The default value is 25.
  99. #sonar.web.http.acceptCount=25

  100. # By default users are logged out and sessions closed when server is restarted.
  101. # If you prefer keeping user sessions open, a secret should be defined. Value is
  102. # HS256 key encoded with base64. It must be unique for each installation of SonarQube.
  103. # Example of command-line:
  104. # echo -n "type_what_you_want" | openssl dgst -sha256 -hmac "key" -binary | base64
  105. #sonar.auth.jwtBase64Hs256Secret=

  106. # The inactivity timeout duration of user sessions, in minutes. After the configured
  107. # period of time, the user is logged out.
  108. # The default value is set to 3 days (4320 minutes)
  109. # and cannot be greater than 3 months. Value must be strictly positive.
  110. #sonar.web.sessionTimeoutInMinutes=4320

  111. # A passcode can be defined to access some web services from monitoring
  112. # tools without having to use the credentials of a system administrator.
  113. # Check the Web API documentation to know which web services are supporting this authentication mode.
  114. # The passcode should be provided in HTTP requests with the header "X-Sonar-Passcode".
  115. # By default feature is disabled.
  116. #sonar.web.systemPasscode=


  117. #--------------------------------------------------------------------------------------------------
  118. # SSO AUTHENTICATION

  119. # Enable authentication using HTTP headers
  120. #sonar.web.sso.enable=false

  121. # Name of the header to get the user login.
  122. # Only alphanumeric, '.' and '@' characters are allowed
  123. #sonar.web.sso.loginHeader=X-Forwarded-Login

  124. # Name of the header to get the user name
  125. #sonar.web.sso.nameHeader=X-Forwarded-Name

  126. # Name of the header to get the user email (optional)
  127. #sonar.web.sso.emailHeader=X-Forwarded-Email

  128. # Name of the header to get the list of user groups, separated by comma (optional).
  129. # If the sonar.sso.groupsHeader is set, the user will belong to those groups if groups exist in SonarQube.
  130. # If none of the provided groups exists in SonarQube, the user will only belong to the default group.
  131. # Note that the default group will always be set.
  132. #sonar.web.sso.groupsHeader=X-Forwarded-Groups

  133. # Interval used to know when to refresh name, email and groups.
  134. # During this interval, if for instance the name of the user is changed in the header, it will only be updated after X minutes.
  135. #sonar.web.sso.refreshIntervalInMinutes=5


  136. #--------------------------------------------------------------------------------------------------
  137. # COMPUTE ENGINE
  138. # The Compute Engine is responsible for processing background tasks.
  139. # Compute Engine is executed in a dedicated Java process. Default heap size is 512Mb.
  140. # Use the following property to customize JVM options.
  141. # Recommendations:
  142. #
  143. # The HotSpot Server VM is recommended. The property -server should be added if server mode
  144. # is not enabled by default on your environment:
  145. #
  146. #
  147. #sonar.ce.javaOpts=-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError

  148. # Same as previous property, but allows to not repeat all other settings like -Xmx
  149. #sonar.ce.javaAdditionalOpts=


  150. #--------------------------------------------------------------------------------------------------
  151. # ELASTICSEARCH
  152. # Elasticsearch is used to facilitate fast and accurate information retrieval.
  153. # It is executed in a dedicated Java process. Default heap size is 512Mb.
  154. #
  155. # --------------------------------------------------
  156. # Word of caution for Linux users on 64bits systems
  157. # --------------------------------------------------
  158. # Please ensure Virtual Memory on your system is correctly configured for Elasticsearch to run properly
  159. # (see for details).
  160. #
  161. # When SonarQube runs standalone, a warning such as the following may appear in logs/es.log:
  162. # "max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]"
  163. # When SonarQube runs as a cluster, however, Elasticsearch will refuse to start.
  164. #

  165. # JVM options of Elasticsearch process
  166. #sonar.search.javaOpts=-Xms512m \
  167. # -Xmx512m \
  168. # -XX:+HeapDumpOnOutOfMemoryError

  169. # Same as previous property, but allows to not repeat all other settings like -Xmx
  170. #sonar.search.javaAdditionalOpts=

  171. # Elasticsearch port. Default is 9001. Use 0 to get a free port.
  172. # As a security precaution, should be blocked by a firewall and not exposed to the Internet.
  173. #sonar.search.port=9001

  174. # Elasticsearch host. The search server will bind this address and the search client will connect to it.
  175. # Default is loopback address.
  176. # As a security precaution, should NOT be set to a publicly available address.
  177. #sonar.search.host=


  178. #--------------------------------------------------------------------------------------------------
  179. # UPDATE CENTER

  180. # Update Center requires an internet connection to request
  181. # It is enabled by default.
  182. #sonar.updatecenter.activate=true

  183. # HTTP proxy (default none)
  184. #http.proxyHost=
  185. #http.proxyPort=
  186. # HTTPS proxy (defaults are values of http.proxyHost and http.proxyPort)
  187. #https.proxyHost=
  188. #https.proxyPort=

  189. # NT domain name if NTLM proxy is used
  190. #http.auth.ntlm.domain=

  191. # SOCKS proxy (default none)
  192. #socksProxyHost=
  193. #socksProxyPort=

  194. # Proxy authentication (used for HTTP, HTTPS and SOCKS proxies)
  195. #http.proxyUser=
  196. #http.proxyPassword=


  197. #--------------------------------------------------------------------------------------------------
  198. # LOGGING

  199. # SonarQube produces logs in 4 logs files located in the same directory (see property sonar.path.logs below),
  200. # one per process:
  201. # Main process (aka. App) logs in sonar.log
  202. # Web Server (aka. Web) logs in web.log
  203. # Compute Engine (aka. CE) logs in ce.log
  204. # Elasticsearch (aka. ES) logs in es.log
  205. #
  206. # All 4 files follow the same rolling policy (see sonar.log.rollingPolicy and sonar.log.maxFiles) but it applies
  207. # individually (eg. if sonar.log.maxFiles=4, there can be at most 4 of each files, ie. 16 files in total).
  208. #
  209. # All 4 files have logs in the same format:
  210. # 1 2 3 4 5 6
  211. # |-----------------| |---| |-|--------------------||------------------------------| |------------------------------------------------------------------------------------------------------------------------------|
  212. # 2016.11.16 16:47:00 INFO ce[AVht0dNXFcyiYejytc3m][o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=org.sonarqube:example-java-maven | type=REPORT | id=AVht0dNXFcyiYejytc3m | submitter=admin | time=1699ms
  213. #
  214. # 1: timestamp. Format is YYYY.MM.DD HH:MM:SS
  215. # YYYY: year on 4 digits
  216. # MM: month on 2 digits
  217. # DD: day on 2 digits
  218. # HH: hour of day on 2 digits in 24 hours format
  219. # MM: minutes on 2 digits
  220. # SS: seconds on 2 digits
  221. # 2: log level.
  222. # Possible values (in order of descending criticality): ERROR, WARN, INFO, DEBUG and TRACE
  223. # 3: process identifier. Possible values: app (main), web (Web Server), ce (Compute Engine) and es (Elasticsearch)
  224. # 4: SQ thread identifier. Can be empty.
  225. # In the Web Server, if present, it will be the HTTP request ID.
  226. # In the Compute Engine, if present, it will be the task ID.
  227. # 5: logger name. Usually a class canonical name.
  228. # Package names are truncated to keep the whole field to 20 characters max
  229. # 6: log payload. Content of this field does not follow any specific format, can vary in length and include line returns.
  230. # Some logs, however, will follow the convention to provide data in payload in the format " | key=value"
  231. # Especially, log of profiled pieces of code will end with " | time=XXXXms".

  232. # Global level of logs (applies to all 4 processes).
  233. # Supported values are INFO (default), DEBUG and TRACE
  234. #sonar.log.level=INFO

  235. # Level of logs of each process can be controlled individually with their respective properties.
  236. # When specified, they overwrite the level defined at global level.
  237. # Supported values are INFO, DEBUG and TRACE
  238. #sonar.log.level.app=INFO
  239. #sonar.log.level.web=INFO
  240. #sonar.log.level.ce=INFO
  241. #sonar.log.level.es=INFO

  242. # Path to log files. Can be absolute or relative to installation directory.
  243. # Default is /logs
  244. #sonar.path.logs=logs

  245. # Rolling policy of log files
  246. # - based on time if value starts with "time:", for example by day ("time:yyyy-MM-dd")
  247. # or by month ("time:yyyy-MM")
  248. # - based on size if value starts with "size:", for example "size:10MB"
  249. # - disabled if value is "none". That needs logs to be managed by an external system like logrotate.
  250. #sonar.log.rollingPolicy=time:yyyy-MM-dd

  251. # Maximum number of files to keep if a rolling policy is enabled.
  252. # - maximum value is 20 on size rolling policy
  253. # - unlimited on time rolling policy. Set to zero to disable old file purging.
  254. #sonar.log.maxFiles=7

  255. # Access log is the list of all the HTTP requests received by server. If enabled, it is stored
  256. # in the file {sonar.path.logs}/access.log. This file follows the same rolling policy as other log file
  257. # (see sonar.log.rollingPolicy and sonar.log.maxFiles).
  258. #sonar.web.accessLogs.enable=true

  259. # Format of access log. It is ignored if sonar.web.accessLogs.enable=false. Possible values are:
  260. # - "common" is the Common Log Format, shortcut to: %h %l %u %user %date "%r" %s %b
  261. # - "combined" is another format widely recognized, shortcut to: %h %l %u [%t] "%r" %s %b "%i{Referer}" "%i{User-Agent}"
  262. # - else a custom pattern. See
  263. # The login of authenticated user is not implemented with "%u" but with "%reqAttribute{LOGIN}" (since version 6.1).
  264. # The value displayed for anonymous users is "-".
  265. # The SonarQube's HTTP request ID can be added to the pattern with "%reqAttribute{ID}" (since version 6.2).
  266. # If SonarQube is behind a reverse proxy, then the following value allows to display the correct remote IP address:
  267. #sonar.web.accessLogs.pattern=%i{X-Forwarded-For} %l %u [%t] "%r" %s %b "%i{Referer}" "%i{User-Agent}" "%reqAttribute{ID}"
  268. # Default value (which was "combined" before version 6.2) is equivalent to "combined + SQ HTTP request ID":
  269. #sonar.web.accessLogs.pattern=%h %l %u [%t] "%r" %s %b "%i{Referer}" "%i{User-Agent}" "%reqAttribute{ID}"


  270. #--------------------------------------------------------------------------------------------------
  271. # OTHERS

  272. # Delay in seconds between processing of notification queue. Default is 60 seconds.
  273. #sonar.notifications.delay=60

  274. # Paths to persistent data files (embedded database and search index) and temporary files.
  275. # Can be absolute or relative to installation directory.
  276. # Defaults are respectively /data and /temp
  277. #sonar.path.data=data
  278. #sonar.path.temp=temp

  279. # Telemetry - Share anonymous SonarQube statistics
  280. # By sharing anonymous SonarQube statistics, you help us understand how SonarQube is used so we can improve the product to work even better for you.
  281. # We don't collect source code or IP addresses. And we don't share the data with anyone else.
  282. # To see an example of the data shared: login as a global administrator, call the WS api/system/info and check the Statistics field.
  283. #sonar.telemetry.enable=true


  284. #--------------------------------------------------------------------------------------------------
  285. # DEVELOPMENT - only for developers
  286. # The following properties MUST NOT be used in production environments.

  287. # Elasticsearch HTTP connector
  288. #sonar.search.httpPort=-1
6.配置sonar-runner.properties(/usr/local/sonar-runner-2.4/conf

點選(此處)摺疊或開啟

  1. #Configure here general information about the environment, such as SonarQube DB details for example
  2. #No information about specific project should appear here

  3. #----- Default SonarQube server
  4. sonar.host.url=http://ip:9000

  5. #----- PostgreSQL
  6. #sonar.jdbc.url=jdbc:postgresql://localhost/sonar

  7. #----- MySQL
  8. sonar.jdbc.url=jdbc:mysql://mysqlip:3306/sonar?useUnicode=true&;characterEncoding=utf8

  9. #----- Oracle
  10. #sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE

  11. #----- Microsoft SQLServer
  12. #sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor

  13. #----- Global database settings
  14. sonar.jdbc.username=root
  15. sonar.jdbc.password=password

  16. #----- Default source code encoding
  17. #sonar.sourceEncoding=UTF-8

  18. #----- Security (when 'sonar.forceAuthentication' is set to 'true')
  19. sonar.login=admin
  20. sonar.password=password
7.建立sonar-project.properties/usr/local/sonar-runner-2.4/conf

點選(此處)摺疊或開啟

  1. # must be unique in a given SonarQube instance
  2. sonar.projectKey=donkey
  3. # this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
  4. sonar.projectName=desktop
  5. sonar.projectVersion=0.0.1

  6. # Path is relative to the sonar-project.properties file. Replace "\" by "/
8.設定elasticsearch.yml(/usr/local/sonarqube-6.7.3/elasticsearch/config

點選(此處)摺疊或開啟

  1. # ---------------------------------- Network -----------------------------------
  2. #
  3. # Set the bind address to a specific IP (IPv4 or IPv6):
  4. #
  5. network.host: ip
  6. #
  7. # Set a custom port for HTTP:
  8. #
  9. http.port: 9200
  10. #
  11. # For more information, consult the network module documentation.

三:啟動
1.用root無法啟動lSonarQube,需要另外新建普通使用者來啟動
useradd esadmin
chown -R esadmin.esadmin /usr/local/sonarqube-6.7.3

2.檔案控制程式碼配置
vim /etc/security/limits.conf


點選(此處)摺疊或開啟

  1. # End of file
  2. root soft nofile 65535
  3. root hard nofile 65535
  4. esadmin soft nofile 262144
  5. esadmin hard nofile 262144
  6. * soft nofile 65535
  7. * hard nofile 65535
3.vm.max_map_count 配置
vim /etc/sysctl.conf 
新增下面配置:
vm.max_map_count=655360
 sysctl -p

4.啟動
以之前建立的esadmin使用者執行命令
./usr/local/sonarqube-6.7.3/bin/linux-x86-64/
sonar.sh
監控 sonar.log  es.log web.log

點選(此處)摺疊或開啟

  1. 018.05.04 16:00:17 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /usr/local/sonarqube-6.7.3/temp
  2. 2018.05.04 16:00:18 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
  3. 2018.05.04 16:00:19 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/usr/local/sonarqube-6.7.3/elasticsearch]: /usr/local/sonarqube-6.7.3/elasticsearch/bin/elasticsearch -Epath.conf=/usr/local/sonarqube-6.7.3/temp/conf/es
  4. 2018.05.04 16:00:19 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
  5. 2018.05.04 16:00:25 INFO app[][o.e.p.PluginsService] no modules loaded
  6. 2018.05.04 16:00:25 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
  7. 2018.05.04 16:01:44 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
  8. 2018.05.04 16:01:44 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/usr/local/sonarqube-6.7.3]: /usr/local/jdk1.8/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/usr/local/sonarqube-6.7.3/temp -Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common

三:驗證
1.sonarque UI介面


2.UI 介面漢化
下載sonar-l10n-zh-plugin-1.19.jar 到 /usr/local/sonarqube-6.7.3/extensions/plugins
重啟sonarqube

3.啟動sonar-runner  對desktop專案程式碼進行分析, 分析結果透過UI介面可以看到。
./usr/local/sonar-runner-2.4/bin/sonar-runner -e -X

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28624388/viewspace-2153847/,如需轉載,請註明出處,否則將追究法律責任。

相關文章