Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
Table of Contents
|
Parameters to configure project analysis can be set in multiple places. Here is the hierarchy of parameters:
Global analysis parameters, defined in the UI, apply to all the projects (From the top bar,프로젝트 분석 환경 설정을 위한 파라미터들은 다양한 위치에서 설정 가능합니다. 파라미터들은 다음과 같은 계층 구조를 가집니다:
Server- Global 분석 파라미터: UI에서 설정하며 모든 프로젝트에 적용됩니다(화면 최상단 bar 메뉴, Settings > General Settings).
- Project analysis parameters, defined in the UI, override global parameters (At a project level, go to Configuration 분석 파라미터: UI에서 설정하며 global 파라미터의 설정 내용을 오버라이딩합니다(프로젝트 레벨, Configuration > Settings).
- Project analysis parameters, defined in a project analysis configuration file or an analyzer configuration file, override the ones defined in the UI
- Analysis / Command line parameters, defined when launching an analysis, override project analysis parameters
Note that only parameters set through the UI are stored in the database.
For example, if you override the sonar.exclusions
parameter via command line for a specific project, it will not be stored in the database. Local analyses in Eclipse, for example, would still be executed with the exclusions defined in the UI and therefore stored in the DB.
Note that the list of parameters below is not exhaustive. The property keys shown in the interface, at both global and project levels, can also be set as analysis parameters.
Mandatory Parameters
- 분석 파라미터: 프로젝트 분석 환경 설정 파일(sonar-project.properties) 혹은 분석 환경 파일(sonar.properties)에서 설정하며, UI에서 설정된 파라미터의 설정 내용을 오버라이딩합니다.
- Analysis / Command Line 파라미터: 분석 실행시 설정하며, project 분석 파라미터의 설정 내용을 오버라이딩 합니다.
UI에서 설정한 파라미터의 설정값들만 SonarQube 데이터 베이스에 저장됩니다.
예를 들어, `sonar.exclusions` 파라미터의 설정값을 커맨드 라인 명령어를 통해 오버라이딩해서 분석을 실행한 경우 해당 내용은 데이터베이스에 저장되지 않습니다. Eclipse를 통해 로컬 분석을 수행하는 경우, exclusion은 UI 상에서 설정되어 있기 때문에 해당 설정값는 데이터베이스에 저장됩니다.
본 섹션에서는 모든 파라미터를 기술하지 않습니다. 인터페이스에 표시되는 프로퍼티 키 역시 global, project 레벨 및 분석 파라미터로 설정할 수 있습니다
필수 파라미터
서버
Key | Description | Default value |
---|---|---|
sonar.host.url | SonarQube Server URL | http://localhost:9000 |
프로젝트 환경 설정
Key | Description | Default value |
---|---|---|
sonar.projectKey |
Allowed characters are: letters, numbers
각 프로젝트가 고유하게 가지고 있는 key 값으로 다음의 문자열을 사용할 수 있습니다:
|
|
<groupId>:<artifactId>
.
Maven을 사용하는 경우 key값은 자동으로 다음으로 설정됩니다: | |
sonar.sources |
Comma-separated paths to directories containing source files.
Compatible with Maven. If not set, the source code is retrieved from the default Maven source code location.
Optional Parameters
Project identity콤마(',')로 구분된 디렉토리 명칭을 입력할 수 있습니다. Maven과 호환되나 그렇지 않은 경우 소스코드는 기본 Maven 코드 저장 위치에서 추출합니다. |
선택 파라미터
프로젝트 식별
Key | Description | Default value |
---|---|---|
sonar.projectName |
Name of the project that will be displayed on the web interface.
Set through <name>
when using Maven.
SonarQube 웹 인터페이스에 표시되는 프로젝트 이름. Maven 프로젝트인 경우 < |
|
sonar.projectVersion |
The project version.
Set through <version>
when using Maven.
Authentication
If Anyone does not have permission to perform analyses, you'll need to supply the credentials of a user with Execute Analysis permission for the analysis to run under프로젝트 버전. Maven 프로젝트인 경우 | 없음 |
인증
분석 수행권한이 없는 사용자로 로그인 한 경우, Execute Analysis 권한을 가진 사용자의 인증 정보를 입력해야 합니다.
Key | Description | Default value |
---|---|---|
sonar.login |
Execute Analysis 권한을 가진 SonarQube 사용자의 로그인 계정 혹은 사용자 토큰. | |
sonar.password |
sonar.login |
사용자 계정의 비밀번호. 사용자 토큰을 사용하는 경우, 공란으로 남겨둡니다. |
웹 서비스
Key | Description | Default value |
---|---|---|
sonar.ws.timeout |
웹 소비스 콜의 최대 응답 대기시간(초) | 60 |
프로젝트 설정
Key | Description | Default value |
---|---|---|
sonar.projectDescription | 프로젝트 설명 |
Not compatible with Maven, which uses the
<description>
attribute.< | |
sonar.links.homepage |
Not compatible with Maven, which uses the
<url>
attribute프로젝트 홈페이지 링크 < url > 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다. | |
Continuous integration |
<ciManagement><url>
attribute<ciManangement ><url > 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다. | |
sonar.links.issue |
Not compatible with Maven, which uses the
<issueManagement><url>
attribute이슈 트래커 < issueManagement ><url > 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다. | |
sonar.links.scm |
Not compatible with Maven, which uses the
<scm><url>
attribute프로젝트 소스 링크 < scm ><url> 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다. | |
sonar.links.scm_dev |
Not compatible with Maven, which uses the
<scm><developerConnection>
attribute개발자 컨텍션 링크 < | |
sonar.tests |
Not compatible with Maven, which retrieves test from the default location for Java Maven projects.
콤마(',')로 구분된 테스트 케이스 파일의 경로 Java Maven 프로젝트의 기본 경로 정보를 사용하는 Maven 프로젝트와 호환되지 않습니다. | |
|
분석 대상 소스 코드 언어 설정 지원 가능한 프로그래밍 언어 리스트는 Plugin Library 페이지(영문)을 참조합니다. 별도로 설정하지 않을 경우 multi-language 분석을 수행합니다. |
| |
|
Set the source file encoding.
소스 코드 파일 인코딩 설정
|
이 속성은 Maven 프로젝트의 project.build.sourceEncoding |
속성으로 대체할 수 있습니다. 사용 가능한 인코딩은 JVM에 따라 상이합니다. 더 많은 정보는 http://docs.oracle.com/javase/1.5.0/docs/guide/intl/encoding.doc.html (column : Canonical Name for java.nio API) |
를 참조합니다(영문). | 시스템 설정 인코딩 |
|
Assign a date to the analysis.
Note: This parameter is applicable to a few, special use cases, rather than being an "every day" parameter:
- When analyzing a new project, you may want to retroactively create some history for the project in order to get some information on quality trends over the last few versions.
- When moving from one database engine to another, it is highly recommended (even mandatory) to start from a fresh new database schema. In doing so, you will lose the entire history for all your projects. Which is why you may want to feed the new SonarQube database with some historical data.
To answer those use cases, you can use the sonar.projectDate property. The format is yyyy-MM-dd
, for example: 2010-12-01
.
The process is the following:
Current date분석 날짜 지정 Note: 이 속성은 특정한 유스케이스에서 활용할 수 있습니다:
위와 같은 유스 케이스에서 사용하고자 하는 경우 프로세스는 아래와 같습니다:
|
- Retrieve the next version of the source code of your application, update the
sonar.projectDate
property, and run another analysis. And so on for all the versions of your application you're interested in.

데이터베이스에 저장된 분석 결과 날짜 이전을 기준으 동일한 프로젝트를 분석할 수 없으며, 시간 순으로 분석할 수 있습니다. 따라서 오래된 버전일 수록 먼저 분석해야 합니다. ![]() | 현재 날짜 |
|
SCM |

브랜치를 관리합니다.
Developer Cockpit 플러그인 사용자인 경우, Developer Cockpit Installation and Usage (영문)의 "Limitation" 섹션을 참조합니다. |
|
|
이 속성은 SonarQube 4.5 |
LTS에서 deprecation 되었으며, 더 이상 사용해서는 안됩니다(SONAR-5370 - |
Deprecate usage of "sonar.profile" as an analysis |
parameter CLOSED 참조). | 해당 언어의 기본 프로파일 |
|
분석을 시작한 디렉토리가 아닌 다른 디렉토리에서 분석을 해야할 경우--즉, 분석은 jenkins/jobs/myjob/ |
workplace에서 시작했으니 ftpdrop/cobol/ |
Specify not the the source directory, but some parent of the source directory. The value specified here becomes the new "analysis directory", and other paths are then specified as though the analysis were starting from the new sonar.projectBaseDir
.
sonar.working.directory
will be createdproject의 코드를 분석해야 하는 경우 등--에 이 속성을 사용합니다. 경로는 절대 경로 혹은 상대 경로를 모두 사용할 수 있습니다. 소스 디렉토리가 아닌 소스 디렉토리의 부모 디렉토리를 지정합니다. 이 속성에 지정한 디렉토리는 새로운 "분석 디렉토리(analysis directory)"로 간주되며, 모든 다른 경로는 분석 프로세스를 진행하기 위해서는 이 디렉토리에 쓰기 권한을 가지고 있어야 하며, 이 디렉토리에는 | |
sonar.working.directory |
SonarQube Scanner |
혹은 SonarQube Ant Task ( |
버전 2.0 이상) |
Path must be relative and unique for each project.
Beware: the specified folder is deleted before each analysis분석 시 사용할 작업 디렉토리를 지정합니다. 경로는 각 프로젝트 별로 상이하며, 고유해야 합니다. 해당 폴더는 분석 시작 직전 삭제 됩니다. | .sonar |
sonar.scm.provider |
이 속성을 사용해 명시적으로 SonarQube가 어떤 SCM 플러그임을 사용해 프로젝트에서 SCM 데이터를 취득해야 할지를 지정할 수 있습니다(auto-detection이 동작하지 않는 경우). 이 속성 값은 항상 소문자로 기록해야 하며 설치한 플러그인에 의존성을 가집니다(예: "tfvc"는 TFVC 플러그인을 의미함). 더 자세한 정보는 각 플러그인의 문서 페이지를 참조합니다. | |
sonar.scm.forceReloadAll |
true
to load blame information for all files. This can be useful is you feel that some SCM data is outdated but SonarQube does not get the latest information from the SCM engine.false
Exclusions / Inclusions
See Narrowing the Focus to:
기본적으로, 변경된 파일에 한해 블레임 정보(blame information)를 취득합니다. 이 속성을 | false |
Anchor exclude-include exclude-include
배제 및 포함
exclude-include | |
exclude-include |
분석 범위 좁히기를 참조해 다음을 확인합니다:
- 분석 대상에서 특정 파일 제외
- 중복 확인 대상에서 특정 파일 제외
- 단위 테스트 및 통합 테스트 커버리지 확인 대상에서 특정 파일 제외
- 특정 컴포넌트 혹은 특정 코딩 규칙 위반으로 인한 이슈 무시
Key | Description | Default value |
---|---|---|
sonar.inclusions |
분석에 포함할 파일 경로 패턴 목록으로, 콤마(,)로 구분합니다. 이 속성을 설정하면 설정된 경로에 해당하는 파일들만을 분석합니다. | |
sonar.exclusions |
분석에서 제외할 파일 경로 패턴 목록으로, 콤마(,)로 구분합니다. | |
sonar.coverage.exclusions |
커버리지 계산에서 제외할 파일 경로 패턴 목록으로, 콤마(,)로 구분합니다. | |
sonar.test.exclusions |
분석에서 제외할 테스트 파일 경로 패턴 목록으로, 콤마(,)로 구분합니다. | |
sonar.test.inclusions |
문석에 포함할 테스트 파일 경로 패턴 목록으로, 콤마(,)로 구분합니다. 이 속성을 설정하면 설정된 경로에 해당하는 테스트 파일만을 분석합니다. | |
sonar.issue.ignore.allfile |
입력한 정규식에 매칭되는 파일들을 분석에서 제외합니다. | |
sonar.import_unknown_files |
| false |
sonar.cpd.exclusions |
코드 중복 식별에서 제외할 파일 경로 패턴 목록으로, 콤마(,)로 구분합니다. |
코드 중복
Key | Description | Default value |
---|---|---|
sonar.cpd.exclusions |
배제 및 포함 섹션을 참조합니다. | |
sonar.cpd.${language}.minimumtokens |
최소 10 라인( |
|
minimumTokens 속성으로 변경 가능)의 중복된 토큰이 발생하는 경우, 해당 코드는 중복된 코드로 식별합니다. Java 프로젝트의 경우, 토큰이나 라인에 관계 없이 최소 10개의 구문이 연속적으로 중복되는 경우, 해당 코드는 중복된 코드로 식별합니다. | 100 |
sonar.cpd.${language}.minimumLines | 10 |
Analysis Logging
분석 로깅
Key | Description | Default value |
---|---|---|
sonar.log.level |
분석 과정에서 생성하는 로그의 품질 / 레벨을 설정합니다. DEBUG: |
Similar to
INFO 레벨 로그 및 DEBUG 레벨을 로그를 표시하며, 다음 속성을 설정한 것과 비슷합니다: TRACE: |
DEBUG 레벨 로그, 모든 ElasticSearch 쿼리 타이밍 로그 및 SonarQube Scanner 서버가 수행하는 Web API 호출 로그를 표시합니다. | INFO |
sonar.verbose |
Add more detail to both client and server-side analysis logs.
클라이언트 및 서버 사이드 분석 로그를 세부적으로 기록합니다.
|
NOTE There is the potential for this setting to expose sensitive information such as passwords if they are stored as server-side environment variablesThis parameter is generating a file containing these timing infos in
| false |
sonar.showProfiling |
Display logs to see where the analyzer spends time.
분석 로그에 분석 엔진이 소요한 시간을 표시합니다. 이 속성을 true로 설정하면, 소요 시간 정보를 포함한 로그 파일인 |
을 생성합니다.
|
|
false | ||
sonar.scanner.dumpToFile | Outputs to the specified file the full list of properties passed to the scanner API as a means to debug analysis. |
Parameters specific to Integration
Those parameters are listed here for completeness of this documentation page - but regular users should not have to worry about them because they mainly target integration use cases인테그레이션에 한정된 파라미터
다음 파라미터들은 인테그레이션에 한정된 파라미터로, 일반 사용자의 경우 크게 신경쓰지 않아도 됩니다.
Key | Description |
---|---|
sonar.analysis.mode |
preview
as part of PR analysis이 속성을 |