with one click
module-dependencies
How to manage module dependencies in IntelliJ codebase. Use when adding or modifying module dependencies in iml files.
Menu
How to manage module dependencies in IntelliJ codebase. Use when adding or modifying module dependencies in iml files.
| name | module-dependencies |
| description | How to manage module dependencies in IntelliJ codebase. Use when adding or modifying module dependencies in iml files. |
This document describes how to manage module dependencies when working with IntelliJ IDEA codebase.
The repository uses a hybrid build system:
build/jpsModelToBazel.cmd after changing .iml filesTo manually run the converter that generates Bazel BUILD files from .iml files:
./build/jpsModelToBazel.cmd
This is useful when:
BUILD.bazel files have auto-generated sections marked with comments:
### auto-generated section `build module.name` start
... generated content ...
### auto-generated section `build module.name` end
### auto-generated section `test module.name` start
... generated content ...
### auto-generated section `test module.name` end
Key rules:
To prevent auto-generation of a section (so you can provide custom content):
### skip generation section `test module.name`
Example - Custom test target with preserved content:
load("@community//build:tests-options.bzl", "jps_test")
# Custom test target (before auto-generated sections)
jps_test(
name = "my-tests_test",
runtime_deps = [
":my-tests_test_lib",
"//:main_test_lib",
],
)
### skip generation section `test my.module.name`
### auto-generated section `build my.module.name` start
... (let generator handle the build section)
Product layouts can include content modules directly. If production runtime already gets a dependency from a content module in the product layout, that content-module dependency can be enough and does not automatically require adding a wrapper plugin dependency to a production .iml or plugin descriptor.
Test plugin resolution is different because tests often do not run with the full production product layout or flat classpath. If a test module loads a plugin whose dependencies include content modules owned by a wrapper plugin, add the wrapper plugin as a test/runtime dependency in the test module .iml instead of broadening the production module dependency. For example, a test that needs Problems View content modules may need intellij.platform.problemView.plugin as a runtime dependency even when the production module only depends on Problems View content modules.
⚠️ DO NOT manually edit .iml files via JetBrains MCP - The IDE's automatic converter runs concurrently and can interfere with edits.
When you need to fix missing dependencies:
Edit tool (not mcp__jetbrains__replace_text_in_file) for .iml files./bazel-build-all.cmdHow to manage module dependencies in IntelliJ codebase. Use when adding or modifying module dependencies in iml files.
Pluginize a Product DSL module set by hand-writing a wrapper plugin module next to its feature modules. Use when promoting modules out of an aggregate module set (e.g. `essential`, `ide.common`) into a bundled plugin so products can include or omit them through normal plugin wiring, when updating bundled plugin registration for such a wrapper, or when fixing tests whose plugin loading logs show a missing wrapper plugin for a former module set.
Pluginize a Product DSL module set by hand-writing a wrapper plugin module next to its feature modules. Use when promoting modules out of an aggregate module set (e.g. `essential`, `ide.common`) into a bundled plugin so products can include or omit them through normal plugin wiring, when updating bundled plugin registration for such a wrapper, or when fixing tests whose plugin loading logs show a missing wrapper plugin for a former module set.
Comprehensive testing reference for running tests in IntelliJ codebase via tests.cmd. Use when running, debugging, or troubleshooting test execution.
Guidelines for implementing IntelliJ actions (AnAction). Use those rules when you need to create or change an action in the intellij platform.
Comprehensive testing reference for running tests in IntelliJ codebase via tests.cmd. Use when running, debugging, or troubleshooting test execution.