Boost IntelliJ IDEA Performance: 10 Simple Tweaks to Eliminate Lag

This article lists ten common IntelliJ IDEA pitfalls—slow performance, Lombok errors, broken breakpoints, encoding issues, unwanted Git files, Maven download slowness, class‑not‑found errors, broken shortcuts, MySQL timezone problems, and automatic reformatting—plus step‑by‑step solutions to make the IDE run smoothly for Java developers.

macrozheng
macrozheng
macrozheng
Boost IntelliJ IDEA Performance: 10 Simple Tweaks to Eliminate Lag

Introduction

IntelliJ IDEA is a powerful Java IDE, but default memory settings, indexing behavior, and plugin configuration can cause performance and usability problems. This guide presents ten common pitfalls and concrete fixes.

Advantages, Disadvantages, and Suitable Scenarios

Advantages

Smart code completion : More accurate than Eclipse.

Powerful refactoring : Safe rename, method extraction, signature changes.

Rich built‑in tools : VCS, database client, HTTP client, terminal.

Extensive plugin ecosystem : Lombok, MyBatis, SonarLint, etc.

Robust debugging : Conditional breakpoints, expression evaluation, remote debugging, memory analysis.

Disadvantages

High memory consumption : Default heap 512 MB‑1 GB, often insufficient for modern projects.

Indexing overhead : Large projects may pause for minutes during re‑index.

Complex configuration : Many optimisations require manual tweaks.

Commercial licensing : Ultimate edition costs money; Community lacks some enterprise features.

Suitable Scenarios

Large Java/Spring projects – IDEA’s Spring support is unmatched.

Small‑to‑medium web projects – Development efficiency far exceeds Eclipse.

Multi‑language projects (Java+JS+Python) – Ultimate edition supports all major languages.

Old machines (RAM < 8 GB) – Consider upgrading hardware or switching to a lighter editor.

Pure front‑end projects – VS Code may be more appropriate.

Students / open‑source learning – Community edition is sufficient.

Pitfall 1 – Laggy IDE and CPU Spikes

Symptoms

After a few hours of use, typing is delayed, the mouse spins, and CPU reaches 100 %.

Root Cause

Insufficient heap memory (default 512 MB‑1 GB) and excessive indexing, especially when “auto‑index external files” is enabled or a large node_modules folder exists.

Solution

Increase IDE heap size by editing idea64.exe.vmoptions (Windows) or /Applications/IntelliJ IDEA.app/Contents/bin/idea.vmoptions (macOS):

# Recommended for an 8 GB machine
-Xms2048m   # initial heap
-Xmx4096m   # max heap
-XX:ReservedCodeCacheSize=512m
-XX:+UseG1GC
-XX:+UseStringDeduplication

Exclude unnecessary directories (e.g., node_modules, .git, target, build) via

File → Settings → Project Structure → Modules → Excluded

.

Pitfall 2 – Lombok Annotations Show Errors

Symptoms

After upgrading IDEA or changing a setting, classes annotated with @Data or @Getter appear red and compilation fails with “cannot find getXxx method”.

Root Cause

Lombok generates code at compile time via an annotation processor. IDEA must have the Lombok plugin installed and annotation processing enabled.

Solution

Install/enable Lombok plugin:

File → Settings → Plugins → Search Lombok → Install & check

.

Enable annotation processing:

File → Settings → Build, Execution, Deployment → Compiler → Annotation Processors → Enable annotation processing

.

Ensure Lombok dependency is present (e.g., version 1.18.30) in pom.xml or build.gradle.

<dependency>
  <groupId>org.projectlombok</groupId>
  <artifactId>lombok</artifactId>
  <version>1.18.30</version>
  <scope>provided</scope>
</dependency>

If the problem persists, invalidate caches: File → Invalidate Caches and Restart.

In rare cases, conflicting .idea configuration files cause the issue; delete the .idea folder and let IDEA regenerate it.

Pitfall 3 – Debug Breakpoints Do Not Hit

Symptoms

Breakpoints placed in a service method are ignored; sometimes the breakpoint icon is gray.

Root Cause

Breakpoint set on a non‑executable line (method signature, empty line, comment).

“Silent breakpoint” or “disable all breakpoints” is active.

JIT inlining in release mode moves the bytecode.

Conditional breakpoints in multithreaded code may never evaluate to true.

Solution

Ensure the breakpoint icon is a solid red circle; if it has a slash, right‑click and enable it.

Open the breakpoint management panel with Ctrl+Shift+F8 and verify that breakpoints are not globally disabled.

Place breakpoints on executable lines, e.g.:

// ❌ Cannot set breakpoint here
public void doSomething() // method signature line

// ✅ Valid breakpoint location
public void doSomething() {
    System.out.println("Breakpoint works here");
}

For conditional breakpoints, check the condition (e.g., str == null) and ensure it can become true.

As a last resort, print stack traces with Thread.currentThread().getStackTrace() or use logging.

Pitfall 4 – Console Shows Garbled Chinese Characters

Symptoms

Log output displays ??? or \uXXXX instead of Chinese text. System.out.println("你好") prints ???.

Root Cause

Encoding mismatch among IDEA console, source files, JVM default encoding, and OS encoding.

Solution

Set all encodings to UTF‑8 via File → Settings → Editor → File Encodings (Global, Project, and Properties files).

Add JVM options: -Dfile.encoding=UTF-8 and -Dconsole.encoding=UTF-8 in Help → Edit Custom VM Options.

For Maven projects, configure project.build.sourceEncoding and project.reporting.outputEncoding to UTF‑8 in pom.xml.

If using Logback or Log4j, set <charset>UTF-8</charset> in the appender configuration.

Pitfall 5 – Unwanted .idea Files Appear in Git Commits

Symptoms

During Commit Changes, files like .idea/workspace.xml, target/, and .iml show up and may be accidentally committed.

Root Cause

IDEA tracks the .idea directory and .iml files by default, but these contain machine‑specific configuration and should be ignored.

Solution

Create a .gitignore at the project root with entries such as:

# Compiled class files
*.class
target/
out/

# IntelliJ IDEA
.idea/
*.iml
*.iws
*.ipr
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/compiler.xml
.idea/libraries/

# Logs
*.log
*.log.gz

# OS files
.DS_Store
._*
Thumbs.db

In IDEA, verify ignored files via Settings → Version Control → Ignored Files.

If .idea was already committed, remove it from the repository history:

git rm -r --cached .idea
git commit -m "Remove .idea from git"

Pitfall 6 – Maven Dependency Downloads Are Extremely Slow

Symptoms

Refreshing Maven projects shows a perpetual spinner; downloads time out or take minutes.

Root Cause

Maven Central is hosted abroad, causing latency. IDEA’s embedded Maven uses the default settings.xml without a domestic mirror, and the local repository may be locked by concurrent processes.

Solution

Configure a Chinese mirror (e.g., Alibaba Cloud) in a custom settings.xml and point IDEA to it via

File → Settings → Build, Execution, Deployment → Build Tools → Maven → User settings file

.

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
  <mirrors>
    <mirror>
      <id>aliyunmaven</id>
      <mirrorOf>central</mirrorOf>
      <name>Alibaba Cloud Public Repository</name>
      <url>https://maven.aliyun.com/repository/public</url>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>jdk-1.8</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <jdk>1.8</jdk>
      </activation>
      <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
      </properties>
    </profile>
  </profiles>
</settings>

Disable “Work offline” and enable “Import Maven projects automatically”.

If network is poor, set an HTTP proxy in

Settings → Appearance & Behavior → System Settings → HTTP Proxy

.

Pitfall 7 – Code Compiles but Fails at Runtime (ClassNotFoundException)

Symptoms

mvn clean compile

succeeds, but running the main method or Spring Boot throws ClassNotFoundException.

Root Cause

IDEA’s output directory ( out/ or target/classes) differs from Maven’s, or annotation processing failed, causing missing classes.

Solution

Enable “Build project automatically” in

File → Settings → Build, Execution, Deployment → Compiler

.

Check each module’s “Output path” and “Test output path” under File → Project Structure → Modules; they should point to target/classes and target/test-classes for Maven projects.

Perform a full rebuild: Build → Rebuild Project.

If still failing, invalidate caches: File → Invalidate Caches and Restart.

Alternatively, build the JAR via Maven command line and run it to verify whether the issue is IDEA‑specific.

Pitfall 8 – Keyboard Shortcuts Stop Working

Symptoms

Common shortcuts like Ctrl+C, Ctrl+V, or Ctrl+Alt+L (reformat code) no longer function or trigger unrelated actions.

Root Cause

Conflicts with other applications (e.g., WeChat screenshot Ctrl+Alt+A, Sogou/Microsoft IME Ctrl+Shift+F).

IDEA’s keymap was unintentionally changed.

Solution

Open File → Settings → Keymap and ensure the expected keymap (e.g., “Default” on Windows or “Mac OS X” on macOS) is selected. Use “Restore Defaults” if necessary.

Identify external software that uses the same shortcuts and reassign or disable those shortcuts.

In the Keymap dialog, search for a specific shortcut (e.g., “Reformat Code”) to see if it’s overridden; remove the conflicting assignment.

Pitfall 9 – Cannot Connect to MySQL from IDEA’s Database Tool

Symptoms

Connection attempts fail with errors like “The server time zone value '???ú±ê×??±??' is unrecognized” or “Could not create connection to database server”.

Root Cause

MySQL 8+ requires an explicit serverTimezone parameter; IDEA’s default connection URL omits it.

Solution

In the Database tool, open the data source settings, go to the “Advanced” tab, and add a parameter:

Name: serverTimezone
Value: Asia/Shanghai

(or UTC).

Alternatively, append the parameter directly to the JDBC URL:

jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=Asia/Shanghai&characterEncoding=utf-8

Ensure the MySQL driver version matches the server version; downgrade via the “Driver” dropdown if necessary.

Pitfall 10 – Automatic Code Reformatting on Commit Breaks Diffs

Symptoms

Before committing, IDEA auto‑formats the file (triggered by Ctrl+Alt+L), causing the entire file to appear changed in git diff, obscuring the real modifications.

Root Cause

IDEA’s “Reformat code / Optimize imports / Rearrange code” options are enabled for the commit workflow. Inconsistent formatting rules across team members amplify the problem.

Solution

Standardize formatting: Add a project‑wide .editorconfig (example below) and share it via VCS. IDEA will detect and apply it automatically.

# .editorconfig
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.java]
indent_size = 4

[*.xml]
indent_size = 2

Export the IDEA code style settings (

File → Settings → Editor → Code Style → Java → Manage → Export

) and commit the exported file for teammates to import.

Disable auto‑reformat on commit: Go to File → Settings → Version Control → Commit and uncheck “Reformat code”, “Optimize imports”, and “Rearrange code”.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DebuggingJavaGitMavenMySQLIntelliJ IDEALombokIDE performance
macrozheng
Written by

macrozheng

Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.