How to build IntelliJ IDEA from source on Windows 11 without git errors

How to Build IntelliJ IDEA from Source on Windows 11 Without Git Errors

Building IntelliJ IDEA from the official open-source repository can be frustrating on Windows, especially when git throws cryptic errors about long paths or line endings. This guide walks you through the exact configuration steps needed to clone the intellij-community repository and set up your development environment on Windows 11, avoiding the most common pitfalls.

Why Windows Users Hit Git Errors

The IntelliJ open-source repository is massive. When you try to clone it on Windows without proper git configuration, you'll likely encounter:

  • Long path errors: Windows has a 260-character path limit by default, and IntelliJ's nested module structure easily exceeds this
  • Line ending conflicts: Git's default core.autocrlf=true converts Unix line endings to Windows CRLF, causing build failures
  • Shallow clone timeouts: Without optimization, even a shallow clone can take 30+ minutes

These aren't code issues—they're environment setup problems that block you before the actual build even starts.

Prerequisites

Before you start, ensure you have:

  • Git for Windows (latest version): Download from https://git-scm.com/
  • IntelliJ IDEA 2023.2 or higher: Download from https://www.jetbrains.com/idea/download
  • Administrator access: Required for some git config changes
  • 20+ GB free disk space: The full repository with build artifacts is large
  • Java 17 or higher: Required by IntelliJ build system

Step 1: Configure Git for Windows Before Cloning

This is critical. Run these commands before you clone the repository:

git config --global core.longpaths true
git config --global core.autocrlf input

What these do:

| Setting | Value | Purpose | |---------|-------|----------| | core.longpaths | true | Removes the 260-character path limit on Windows (requires Windows 10+) | | core.autocrlf | input | Preserves Unix line endings (LF) in the repository instead of converting to Windows (CRLF) |

If you're using Git Bash, you can verify these settings with:

git config --global --list | grep core

You should see both settings confirmed in the output.

Step 2: Clone the Repository with Optimization

The full repository history is over 2GB. For faster setup, create a shallow clone with only the latest revision:

git clone --depth 1 https://github.com/JetBrains/intellij-community.git
cd intellij-community

If you need the full history (for plugin development or git blame investigations), omit --depth 1, but expect 15-30 minutes depending on your connection.

Alternative: Clone Directly from IntelliJ IDEA

IntelliJ IDEA can handle the git configuration and shallow clone setup automatically:

  1. Open IntelliJ IDEA
  2. Click "Get from VCS" on the welcome screen
  3. Paste https://github.com/JetBrains/intellij-community.git
  4. Check the "Create shallow clone" checkbox
  5. Click Clone

This approach handles Windows-specific path issues automatically.

Step 3: Fetch Android Modules

IntelliJ IDEA's IDE-specific features require Android modules from separate repositories. From your intellij-community directory:

On Windows (PowerShell or Command Prompt):

.\getPlugins.bat

Critical requirement: Ensure both the main repository and Android modules are checked out to the same branch/tag. If you pulled the master branch for intellij-community, verify Android modules are also on master:

cd android
git branch -a
git checkout master

This mismatch is a silent killer—your build will fail with obscure compilation errors if repositories are out of sync.

Step 4: Open in IntelliJ and Configure Project

  1. Open the <IDEA_HOME> directory in IntelliJ IDEA
  2. Wait for indexing to complete (this takes 5-10 minutes)
  3. The IDE will auto-detect the project structure and gradle configuration
  4. IntelliJ will prompt you to download the required JDK—accept this

Step 5: Build and Run

Once the project is indexed:

  1. Go to Build → Build Project
  2. For a complete build: Build → Build Artifacts → IntelliJ IDEA Community Edition
  3. To run locally: Run → Run 'IntelliJ IDEA' (from the configurations dropdown)

The first build takes 10-20 minutes. Subsequent builds are cached and much faster.

Common Windows-Specific Issues and Fixes

Issue: "Filename too long" error during clone

Cause: core.longpaths not enabled

Fix:

git config --global core.longpaths true
# Then reclone

Issue: Git merge conflicts in build files after cloning

Cause: core.autocrlf=true is converting line endings

Fix:

git config --global core.autocrlf input
rm -rf intellij-community
git clone --depth 1 https://github.com/JetBrains/intellij-community.git

Issue: Android modules fail to build with "unresolved reference" errors

Cause: Android modules are on a different branch than main repository

Fix:

# In intellij-community root
git branch -a
# Note your current branch (e.g., remotes/origin/master)

# Go to android directory
cd android
git checkout <same-branch-name>

Issue: Build fails with "out of memory" errors

Cause: IntelliJ doesn't have enough heap space

Fix: Increase heap size in idea.properties:

# In <IDEA_HOME>/bin/idea.properties
-Xmx4g

Verification Checklist

Before you start building, verify:

  • [ ] Git config has core.longpaths=true
  • [ ] Git config has core.autocrlf=input
  • [ ] You've run getPlugins.bat and Android modules exist
  • [ ] IntelliJ IDEA 2023.2+ is installed
  • [ ] Project indexing has completed (bottom right status bar shows "Indexing complete")
  • [ ] You have 20+ GB free disk space

Next Steps

Once you've built IntelliJ successfully, you can:

  • Develop plugins: The source code is ready for IDE plugin development
  • Contribute to IntelliJ: See CONTRIBUTING.md for pull request guidelines
  • Customize the build: Modify source files and rebuild locally to test changes
  • Debug the IDE itself: Run the IDE in debug mode to step through IntelliJ's internals

The entire open-source build process is CI/CD validated on GitHub Actions, so your local build matches what JetBrains ships—with the bonus that you have full source code access.

Recommended Tools