Sonar安裝筆記

Sonar是開源的代碼質量管理平臺,它把代碼質量相關軟件集成到一起統一管理,集成的軟件如下:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->CPD
Checkstyle
Clover
Cobertura
Findbugs
General
Google analytics
PMD
Squid
Surefire

我把安裝過程記錄下來.
1.環境準備如下
<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->ubuntu8.04
jdk1
.5
maven2
.2(官方要求2.0.7以上)
mysql5
.0

2.下載Sonar,到http://sonar.codehaus.org/下載最新版本,目前是1.9.2,下載後解壓即可

3.數據庫配置
<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
grant all on sonar.* to sonar@'%' identified by 'sonar';
grant all on sonar.* to sonar@localhost identified by 'sonar';
flush 
privileges;
官方沒有grant all on sonar.* to sonar@'%' identified by 'sonar'; 如果你想遠程發佈項目到sonar,那就需要加上這條
然後還要更改sonar的配置,在sonar的解壓目錄下打開conf/sonar.properties,注掉如下內容(如果你沒有mysql就可以不改動這個文件,sonar默認使用內嵌數據庫derby)
<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->#sonar.jdbc.url:                            jdbc:derby://localhost:1527/sonar;create=true
#sonar.jdbc.driverClassName:                org.apache.derby.jdbc.ClientDriver
#sonar.jdbc.validationQuery:                values(
1)
去掉下面的註釋
<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->sonar.jdbc.url:                            jdbc:mysql://192.168.1.151:3306/sonar?useUnicode=true&characterEncoding=utf8
sonar.jdbc.driverClassName:                com.mysql.jdbc.Driver
sonar.jdbc.validationQuery:                select 
1

Ok,配置已經完成你可以在bin目錄項下進入相應平臺的子目錄,比如我的就是${sonar_home}bin/linux-x86-32,sonar是多平臺的,你可以在bin目錄下查找你對應的平臺,然後執行
<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->${sonar_home}bin/linux-x86-32/sonar.sh start

啓動後訪問http://localhost:9000就可以進入sonar了, 默認管理員用戶和密碼是admin/admin

大功告成!

今天先寫到這,後面我會加上如何用maven發佈一個項目到sonar上!

秀幾張圖來看看







發佈了3 篇原創文章 · 獲贊 0 · 訪問量 8581
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章