--- title: SpotBugs Gradle Plugin — 공식 문서 source_type: official-doc url: https://spotbugs.readthedocs.io/en/stable/gradle.html archive_url: related_branches: [feature-static-analysis-quality-contract] related_projects: [ca-skeleton, ca-tmpl] tags: [official-doc, ca-skeleton, ci-cd, gradle, build-tooling] created: 2026-06-15 --- # SpotBugs Gradle Plugin — 공식 문서 > Layer: `raw/` — 외부 자료(공식 문서)의 **원문 발췌·출처 기록**. > 검증된 요약은 `/ingest` 후 `wiki/concepts/`에 `source-summary-template` 형식으로 별도 작성. 원본은 raw에 영구 보관. ## Parent / 활용 branch (필수) | Branch | 이 자료가 정당화하는 결정 | |---|---| | [[raw/branch-notes/feature-static-analysis-quality-contract]] | D3/D4/D9 — SpotBugs Gradle plugin (`com.github.spotbugs`) 채택, `spotbugsPlugins` configuration 으로 FindSecBugs 연동, `check` task 자동 집계(`./gradlew check`) | ## 출처 / Source - 원본 URL: https://spotbugs.readthedocs.io/en/stable/gradle.html - 아카이브 URL: (미기록 — 추후 archive.org 스냅샷 병기 권장) - 저자 / 조직: spotbugs community - 발행일: (문서 내 미기재, 저작권 표기 2016-2022) - 마지막 확인일: 2026-06-15 ## 왜 저장했는지 / Why archived SpotBugs Gradle Plugin 의 공식 설정 방법(플러그인 적용, `check` task 자동 의존성, `spotbugsPlugins` configuration, `toolVersion` 지정)을 verbatim 근거로 확보하기 위해 보관. `feature-static-analysis-quality-contract` 의 D3(plugin 채택), D4(FindSecBugs 연동), D9(`check` task 집계) 결정의 직접 근거. ## 핵심 인용 / Key quotes (verbatim, self-grep 통과) > [§ Tasks introduced by this Gradle Plugin] "SpotBugs Gradle Plugin adds task dependency from check to these generated tasks, so you can simply run ./gradlew check to run SpotBugs." > [§ Tasks introduced by this Gradle Plugin] "This Gradle Plugin generates task for each sourceSet generated by Gradle Java Plugin." > [§ Configure Gradle Plugin — code block] "spotbugs { > toolVersion = '4.10.2' > }" > [§ Introduce SpotBugs Plugin — code block] "spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0'" > [§ Use SpotBugs Gradle Plugin] "Note that SpotBugs Gradle Plugin does not support Gradle v6, you need to use v7.0 or later." ## Claims Extracted / 추출된 주장 > 이 자료가 **직접 말하는 것만** claim 으로 분리한다. | Claim ID | Claim (이 자료가 직접 말하는 것) | Evidence quote | Strength | Applies to | Does not prove | |---|---|---|---|---|---| | SPOTBUGS-GRADLE-C1 | SpotBugs Gradle Plugin은 `check` task 에 생성된 spotbugs task 에 대한 의존성을 자동으로 추가하므로 `./gradlew check` 한 번으로 SpotBugs 분석을 실행할 수 있다 | [§ Tasks introduced] "SpotBugs Gradle Plugin adds task dependency from check to these generated tasks, so you can simply run ./gradlew check to run SpotBugs." | `official-vendor-doc` | SpotBugs Gradle Plugin 을 적용한 모든 Gradle 프로젝트 (Gradle v7.0+) | `check` task 내에서 SpotBugs 가 *최초*로 실행되는 순서·병렬 여부; 실제 CI gate 차단 동작 | | SPOTBUGS-GRADLE-C2 | Gradle Java Plugin 이 생성하는 각 sourceSet(예: main, test)마다 별도 spotbugs task(예: spotbugsMain, spotbugsTest)가 자동 생성된다 | [§ Tasks introduced] "This Gradle Plugin generates task for each sourceSet generated by Gradle Java Plugin." | `official-vendor-doc` | Gradle Java Plugin + SpotBugs Gradle Plugin 동시 적용 시 | Base Plugin 사용 시(자동 task 미생성 경로); multi-project 세부 동작 | | SPOTBUGS-GRADLE-C3 | `spotbugs { toolVersion = '...' }` Extension 블록으로 SpotBugs 버전을 명시 지정할 수 있다 | [§ Configure Gradle Plugin] "spotbugs { toolVersion = '4.10.2' }" | `official-vendor-doc` | SpotBugs Gradle Plugin Extension 설정 범위 | 사용 가능한 모든 toolVersion 목록; 버전 간 동작 차이 | | SPOTBUGS-GRADLE-C4 | `dependencies { spotbugsPlugins '' }` 선언으로 FindSecBugs 등 SpotBugs 플러그인을 추가할 수 있다 | [§ Introduce SpotBugs Plugin] "spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0'" | `official-vendor-doc` | SpotBugs Gradle Plugin 이 제공하는 `spotbugsPlugins` configuration | FindSecBugs 가 특정 룰을 실제로 검출하는지 여부; 룰셋 내용 | | SPOTBUGS-GRADLE-C5 | SpotBugs Gradle Plugin 은 Gradle v6 를 지원하지 않으며 v7.0 이상이 필요하다 | [§ Use SpotBugs Gradle Plugin] "Note that SpotBugs Gradle Plugin does not support Gradle v6, you need to use v7.0 or later." | `official-vendor-doc` | SpotBugs Gradle Plugin 최소 요구 사항 | Gradle v7.x 의 구체적 최소 패치 버전; Gradle v8+ 의 지원 여부 | ## Usage Boundaries / 적용 경계 - 이 자료가 직접 증명하는 것: - `SPOTBUGS-GRADLE-C1`: `./gradlew check` 하나로 SpotBugs 분석이 자동 포함됨 - `SPOTBUGS-GRADLE-C2`: sourceSet 별 별도 task 자동 생성 - `SPOTBUGS-GRADLE-C3`: `toolVersion` 으로 SpotBugs 버전 고정 방법 - `SPOTBUGS-GRADLE-C4`: `spotbugsPlugins` 로 FindSecBugs 등 플러그인 추가 방법 - `SPOTBUGS-GRADLE-C5`: Gradle v7.0+ 필수 요구사항 - 이 자료가 증명하지 않는 것: - `effort`, `reportLevel`, `excludeFilter` 등 상세 Extension 속성 — 본 페이지는 `SpotBugsExtension` 문서를 외부 참조로만 안내; 상세 속성은 별도 Extension 문서 확인 필요 - plugin id `com.github.spotbugs` 적용 코드 — 본 페이지는 "official Gradle Plugin page 지침을 따르라"고만 안내하며 코드 블록 미제공; Gradle Plugin Portal(https://plugins.gradle.org/plugin/com.github.spotbugs) 에서 `plugins { id("com.github.spotbugs") version "..." }` 확인 - FindSecBugs 가 실제 보안 취약점을 검출하는지 여부 및 룰 내용 - multi-project build 세부 설정 - 내 프로젝트에 적용하려면 추가 확인이 필요한 것: - ca-tmpl/ca-skeleton 의 실제 Gradle 버전이 v7.0 이상인지 검증 (C5) - `check` task 가 CI pipeline gate 에서 실제 차단 동작하는지 로컬 검증 (C1) - `effort` / `reportLevel` / `excludeFilter` 설정 — SpotBugsExtension 공식 문서(`https://javadoc.io/doc/com.github.spotbugs/spotbugs-gradle-plugin/`) 별도 참조 필요 ## 메모 / Notes - 본 페이지는 plugin 적용 코드 블록을 직접 제공하지 않고 Gradle Plugin Portal 로 위임. 실제 `plugins { id("com.github.spotbugs") version "..." }` DSL 코드는 https://plugins.gradle.org/plugin/com.github.spotbugs 에서 확인. - `effort`, `reportLevel`, `excludeFilter` 설정은 SpotBugsExtension Javadoc 또는 spotbugs-gradle-plugin README 를 별도 원본으로 추가 아카이빙 권장. - 페이지 제목은 "spotbugs 4.10.2 documentation" 이나 이는 readthedocs 빌드 기준이며 플러그인 최신 버전과 다를 수 있음 (2026-06-15 기준 Gradle Plugin Portal 최신: 6.5.6). ## Related / 관련 - Gradle Plugin Portal 페이지: https://plugins.gradle.org/plugin/com.github.spotbugs (plugin id `com.github.spotbugs` 적용 코드 확인) - SpotBugsExtension API 문서: https://javadoc.io/doc/com.github.spotbugs/spotbugs-gradle-plugin/ (`effort`, `reportLevel`, `excludeFilter` 등 상세 속성) - spotbugs-gradle-plugin GitHub README: https://github.com/spotbugs/spotbugs-gradle-plugin - 같은 branch 의 ArchUnit 근거 자료: [[raw/official-docs/archunit-user-guide]]