21
21

More than 5 years have passed since last update.

WindowsでSonarQube設定とりあえず

Last updated at Posted at 2014-10-24

以下のURLからSonarQube と SonarQube Runner をダウンロードして解凍する。

c:\ 直下に置く。

C:\sonarqube-4.5
C:\sonar-runner-2.4

以下のURLから無料Javaをダウンロードしてインストールする。

とりあえずポスグレでデータベースsonarを作っておく。

c:\Program Files\PostgreSQL\9.3\bin\createdb -U postgres sonar

C:\sonarqube-4.5\conf\sonar.properties の以下の部分をコメントアウトを外す、もしくは編集。

# User credentials.
# Permissions to create tables, indices and triggers must be granted to JDBC user.
# The schema must be created first.
sonar.jdbc.username=postgres
sonar.jdbc.password=password
#----- PostgreSQL 8.x/9.x
# If you don't use the schema named "public", please refer to http://jira.codehaus.org/browse/SONAR-5000
sonar.jdbc.url=jdbc:postgresql://localhost/sonar

C:\sonar-runner-2.4\conf\sonar-runner.propertiesの以下の部分を編集もしくはコメントアウトを外す。

#----- PostgreSQL
sonar.jdbc.url=jdbc:postgresql://localhost/sonar
#----- Global database settings
sonar.jdbc.username=postgres
sonar.jdbc.password=password

起動。

C:\sonarqube-4.5\bin\windows-x86-64\StartSonar.bat

に接続。
admin:admin
でログインしてsettingsからupdate centerを選んでプラグインとかいろいろいれておく。

自分の作成した(調べたい)プロジェクトのディレクトリにcdして、以下のURLのサンプルを参考にsonar-project.propertiesファイルを設置する。

そのままプロジェクトのディレクトリ内で、以下を実行。

C:\sonar-runner-2.4\bin\sonar-runner.bat

ちなみにこの自分のプロジェクトディレクトリに置くsonar-project.propertiesファイルだけど、以下の一行

sonar.language=php

を消せば、他の言語(jsとかcssとかhtmlとか)もまとめてやってくれる。
jquery.min.jsとかbootstrap.cssとかを除外するには、以下のようなパラメータを追加する。(CakePHPの例)

sonar.exclusions=app/webroot/js/lib/*.js,app/webroot/css/bootstrap*css,app/webroot/css/cake.generic.css 

あるいは9000画面から設定→除外→Filesへ。

21
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
21