본문 바로가기

프로젝트/Tool, 오픈 소스 등

소스 품질 관리 - sonarqube

소스품질 관리 -  www.sonarqube.org


개발에서 소스의 품질관리는 중요한 요소이다. 


이번글에서는 간단히 sonarqube를 프로젝트에 적용하는 방법에 대해 기술하고자 한다.


먼저 아래의 구조를 부면 소스의 품질 관리를 위해 다음과 같은 두가지가 필요하다.

소스를 분석 -> SonarQube Runner

분석된 결과 확인 -> SonarQube


0. Prerequisites

  - Java 6 or higher


1. 다운로드

  - SonarQube :  http://www.sonarqube.org/downloads/ 에서 

     [SonarQube 4.4 – July 31, 2014] 를 다운받는다.

  - SonarQube Runnerhttp://www.sonarqube.org/downloads/ 에서 

     [SonarQube Runner]를 다운받는다.


2. 설치

  - 다운받은 파일의 ZIP을 원하는 위치에 푼다.

  - 환경변수 PATH에 SonarQube Runner <install_directory>/bin 를 추가한다.


3. 실행

  - SonaQube의 <iantll_directory>\bin\windows-x86-xx\StartSonar.bat 를 실행시킨다.


 - 분석할 프로젝트에 다음과 같은 properties를 추가시킨다. (project 디렉토리에 파일 생성)

    : 파일이름 : sonar-project.properites

#----- Default SonarQube server
sonar.host.url=http://localhost:9000
 
#----- PostgreSQL
#sonar.jdbc.url=jdbc:postgresql://localhost/sonar
 
#----- MySQL
#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
 
#----- Oracle
#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE
 
#----- Microsoft SQLServer
#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor
 
#----- Global database settings
#sonar.jdbc.username=sonar
#sonar.jdbc.password=sonar

  - SonarQube Runner를 실행시킨다. (소스 분석)

  


  - 결과를 확인한다. : http://localhost:9000/