Excluding Files in IntelliJ IDEA | Generated by AI

Home 2025.09

In IntelliJ IDEA, you can exclude files or directories so they don’t appear in search, indexing, code completion, or builds. There are several ways to do it depending on your purpose:


1. Mark a Directory as Excluded

This is typically used for build output folders (target/, out/, dist/, etc.).


2. Exclude from Version Control (VCS Ignore)

If you don’t want IDEA (and Git) to track certain files:


3. Exclude Files from Code Analysis / Inspections


4. Exclude from Build (Gradle/Maven)

If you’re using Gradle or Maven, you can configure build.gradle or pom.xml to exclude certain directories (like generated code or resources). IDEA respects these build tool configurations.


5. Exclude Specific File Types


👉 Quick tip: If your goal is just to stop IDEA from wasting resources indexing large folders (like node_modules/), the Mark Directory as Excluded option is the fastest and most effective.

Do you want me to also show you how to exclude test directories (like src/test/java) from code coverage runs in IDEA?


Back Donate