github/gitignore · Kotlin.gitignore

Kotlin .gitignore 템플릿 해설

Kotlin.gitignore가 .class·jar 등 JVM 산출물과 Kotlin 2.0의 .kotlin 디렉터리를 무시하는 이유와 Gradle·Android 템플릿과 조합할 때의 주의점을 설명합니다.

생성기에서 열기 Gradle, Android, JetBrains, macOS 함께 열기

Kotlin.gitignore는 Java 템플릿의 규칙에 Kotlin Gradle 플러그인이 쓰는 .kotlin/ 디렉터리를 더한 형태다. Kotlin/JVM 코드를 컴파일하면 Java와 같은 .class·.jar가 나오기 때문이다.

빌드 도구 규칙은 들어 있지 않다. 대부분의 Kotlin 프로젝트는 Gradle을 쓰므로 Gradle 템플릿을, 안드로이드 앱이라면 Android 템플릿을 함께 고른다.

규칙별 해설

패턴무엇을, 왜 무시하나
.kotlin/Kotlin Gradle 플러그인 데이터Kotlin 2.0부터 Gradle 플러그인이 프로젝트 루트의 .kotlin 폴더에 세션 정보와 오류 로그 같은 데이터를 저장한다. Kotlin 문서도 이 폴더를 .gitignore에 추가하라고 안내한다.
*.class*.jar*.war*.nar*.ear*.zip*.tar.gz*.rar컴파일 결과·아카이브JVM 바이트코드와 배포 아카이브다. 소스와 빌드 스크립트만 있으면 다시 만들 수 있다.
hs_err_pid*replay_pid*JVM 크래시 로그JVM 비정상 종료 시 남는 진단 파일이다.
*.log*.ctxt.mtj.tmp/기타실행 로그와 BlueJ·J2ME 도구 파일이다. Java 템플릿에서 그대로 이어받은 규칙이다.

실무에서 주의할 점

원본 템플릿

Kotlin.gitignore규칙 14줄
# Compiled class file*.class# Log file*.log# BlueJ files*.ctxt# Mobile Tools for Java (J2ME).mtj.tmp/# Package Files #*.jar*.war*.nar*.ear*.zip*.tar.gz*.rar# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xmlhs_err_pid*replay_pid*# Kotlin Gradle plugin data, see https://kotlinlang.org/docs/whatsnew20.html#new-directory-for-kotlin-data-in-gradle-projects.kotlin/

템플릿 출처: github/gitignore/Kotlin.gitignore @356fd7b (2026-09-11) · CC0-1.0

함께 쓰는 템플릿

다른 템플릿 해설