IntelliJ IDEA adding requires statements automatically to module-info.java
I'm working on a project that is using Java modules and just adding the modules I needed like:
requires jakarta.transaction;
requires static lombok;
requires jakarta.validation;
requires jakarta.cdi;
requires jakarta.interceptor;
requires jakarta.concurrency;
The IDE is adding automatically:
requires jakarta.jakartaee.web.api
requires jakarta.jakartaee.web.api
I have not identified when exactly, if it is at reboot, project opening, after compilation, etc.
I'm noticing this because while compiling I see the error:
[ERROR] the unnamed module reads package jakarta.validation.executable from both jakarta.jakartaee.api and jakarta.jakartaee.web.api
Is there any configuration that may be used to avoid this behavior?
Thanks in advance for any suggestions.
Using: Java 21
请先登录再写评论。
Sure, Let me try
Hello guys! Have the same problem now with IntelliJ IDEA 2025.2.1 (Ultimate Edition)
Disabling all non-bundled plugins not solved the issue.
Did you find the solution?
G Kozyryatskyy, this behavior has been reported before, there's a feature request to improve it:
IDEA-377947
I would recommend adding the issue to your watch list and upvote it to give more visibility.
Ilnur Galimov Thank you for your reply! Ok i will upvote.
But to be clear:
1) Are you saying that I cant disable this behavior right now? It is happening few times a day for me and all the time I need manually revert the module-info.java (it is breaking the project tests execution, etc) ?
2) Is there somewhere a list of files that Intellij randomly modifies with out user confirmation or request? =) Sounds like a security issue for me.
G Kozyryatskyy, what could be happening is that IntelliJ IDEA runs inspections and quick-fix suggestions that can insert module dependencies automatically. They can be triggered either automatically on save, or when IntelliJ runs pre-commit checks.
Could you please check your settings in Settings | Version Control | Commit and in Settings | Tools | Actions on Save?
Related docs:
Adjusting these settings should stop the unwanted additions to
module-info.java.Hope that helps.
Ilnur Galimov
My settings:
- Settings | Version Control | Commit → all Commit Checks are disabled. Had just Advanced Commit Checks with ‘Analyze code’ and ‘Check TODO’. Disable everything.
- Settings | Tools | Actions on Save → all disabled
Thank you for your suggestion. Will see how it goes.
G Kozyryatskyy, I'd also recommend checking your inline completion settings here: Settings | Editor | General | Inline Completion. Please let me know the results.
Ilnur Galimov My Inline Completion page is empty. Nothing there.
Problem still exists after all the discussed changes.
G Kozyryatskyy, could you please go to Settings | Plugins | Installed and make sure that the Full Line Code Completion plugin is enabled and up to date? Once enabled, restart your IDE and check your cloud completion settings in Settings | Editor | General | Inline Completion.
Ilnur Galimov
Full Line Code Completion was disabled. I think this is because some time ago I was trying to fix module-info.java problem by disabling all the plugins =)
Here is current settings. Is it can help me with module-info.java problem somehow?
G Kozyryatskyy, as I can see you don't have the cloud completion settings here meaning the JetBrains AI Assistant in your IDE is also disabled, so there must be something different causing the issue.
Let's try another approach. Could you please go to Settings | Editor | General | Auto Import and in the Java section try adding the affected packages and classes to the exclusions from auto-import and completion to see if that helps.
Ilnur Galimov Do not know how, but problem is stop happening. Im not seeing it ~last 2 weeks. Mb your last suggestions helped to fix it.
Anyway, thank you very much for helping me to fix it!
Sorry for not being able to confirm the exact fix solution =(
G Kozyryatskyy, thank you for the update. Glad to hear that the issue was resolved!
For IntelliJ IDEA 2025.3 EAP, Build #IU-253.27864.23, built on October 22, 2025, Source revision: 1c9706c7059f6 the workaround with exclustion does not work
Oliver Kopp Your issue seems similar to be the existing bug IDEA-380666 also affecting 2025.3.