Auto-Compilation Breaks Maven Builds

已回答

Problem description:

"Build project automatically" (Settings > Build, Execution, Deployment > Compiler) states it "Works while not running / debugging". However, auto-compilation continues to write to target/classes during Maven builds (e.g. “running”) launched from the IDE terminal. This causes file contention — particularly severe on Windows/NTFS where deleted files enter a DELETE PENDING state that blocks recreation by other processes. Parallel Maven builds exacerbate the problem, but the issue is observed on sequential builds.

Steps to reproduce:

 1. Open a large multi-module Maven project in IntelliJ IDEA
 2. Enable "Build project automatically" in Settings > Compiler
 3. Start a parallel Maven build from the IDE terminal (e.g. mvn clean install -T1C)
 4. Observe via Process Monitor (ProcMon) that JPS builders fire during the Maven build, deleting and rewriting files in target/classes
 5. Maven fails intermittently with errors such as "could not create parent directories", "Access Denied", or "NAME NOT FOUND"
 6. Disabling "Build project automatically" eliminates the failures (tested: 0/10 failures with auto-build OFF vs 2-4/10 with auto-build ON)

Expected behaviour: 

Auto-compilation should pause while a build/run process is active, as the setting description implies.

Actual behaviour: 

JPS file watcher detects Maven's changes in target/, dispatches JPS builders which delete and recompile target/classes concurrently with the running Maven build. The “Delegate IDE build/run actions to Maven” setting does NOT suppress auto-make (consistent with IDEA-228279).

Environment:

  • OS: Windows 11 Enterprise 25H2 26200.8390
  • JDK: AmazonCorretto 17
  • Build tool: Maven IDE plugin (parallel build, -T1C)
  • Project: Large multi-module Java/Jakarta EE project (~50+ modules)
0

Hi Matthew,

The problem is mainly tracked in IDEA-228337 (and IDEA-212052 for Gradle). 

I submitted a new bug report to YouTrack about the problem with Maven: IDEA-389429. Our developers will take a look at it as soon as they can.

You can upvote the ticket and follow it for updates. See this article if you are not familiar with our bug tracking system.

--

In the future, you can submit bug reports directly to YouTrack. This ensures that the issue will be checked as soon as possible and that you will receive timely updates without any extra actions on your part. Thanks.

0

请先登录再写评论。