本文へ移動
cccskills
無料GitHub で公開日本語紹介

module-dependencies

IntelliJの`.iml`ファイルでモジュール依存関係を追加・変更し、関連する生成ファイルやライブラリ設定を同期する手順を案内します。

原文原文の説明を見る

Add or modify IntelliJ module dependencies in `.iml` files.

JetBrains/intellij-communityスター 20,664(GitHub 20,664 + cccskills 0)

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • `.iml`にモジュール依存関係を追加したいとき
  • 変更後にBazelの生成ファイルを同期したいとき
  • ライブラリのバージョン更新を点検したいとき
  • テストからKotlinの内部宣言を使いたいとき

日本語での紹介

できること

IntelliJのJPSモジュール依存関係を.imlファイルで追加・変更し、関連する登録情報や生成ファイルを整合させる手順を案内します。モジュールを作成・編集した後は、jps-module.mjsで登録状態を確認し、jpsModelToBazel.cmdで.imlをもとにBazelのBUILDファイルを再生成します。ライブラリのバージョン更新では、専用のdashboardコマンドでPOMとのアーティファクト整合性を確認し、Fleet側のバージョンコピーやBazelのロックファイルも更新する流れを扱います。テストモジュールからKotlinのinternal宣言を参照する設定や、自動生成領域の扱いも説明します。

こんなときに便利

依存関係の不足を修正するときや、.iml変更後にビルド定義が古いままになっていないか確認したいときに役立ちます。ライブラリ更新や、別モジュールのテストから内部宣言を使う設定にも向いています。

使い方の例

  • 「このモジュールに必要な依存関係を追加し、生成ファイルも同期してください」
  • 「ライブラリのバージョンを更新し、関連するコピーやロックファイルを確認してください」
  • 「テストモジュールから対象のinternal宣言を参照できるようにしてください」

注意点

IntelliJのリポジトリ構成に沿った手順を対象とします。ライブラリ解決を再現するdownloadLibraries.cmdの実行にはSpaceの認証情報が必要です。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(1)

  • SKILL.md9.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

<!-- Generated by community/.ai/render-guides.mjs; edit community/.agents/skills/module-dependencies/SKILL.md -->

Module Dependencies Management

This document describes how to manage module dependencies when working with IntelliJ IDEA codebase.

Documentation

Build System Overview

The repository uses a hybrid build system:

  • JPS (*.iml files): Source of truth for module dependencies
  • Bazel (BUILD files): Auto-generated from *.iml files
  • Generator: run build/jpsModelToBazel.cmd after changing .iml files

JPS Module Registration Helper

When creating or editing a JPS module .iml, use the helper instead of hand-editing project module lists:

bun build/jps-module.mjs register <path-to-iml> --fix-iml-eof

The helper:

  • registers the module in .idea/modules.xml
  • also registers community/... modules in community/.idea/modules.xml
  • inserts entries in the canonical order: .iml basename without the .iml suffix, matching org.jetbrains.intellij.build.ModulesXml
  • removes trailing line breaks from the listed .iml files when --fix-iml-eof is passed

Use bun build/jps-module.mjs check <path-to-iml> --fix-iml-eof to verify without writing.

Running the IML-to-Bazel Generator

To manually run the converter that generates Bazel BUILD files from .iml files:

./build/jpsModelToBazel.cmd

This is useful when:

  • The automatic converter didn't run (e.g., .iml files were modified outside the IDE)
  • You need to regenerate BUILD files after git operations
  • Troubleshooting build system synchronization issues

Library Version Changes

Bump a library with the dashboard tool, not by hand: bun community/build/libraries-dashboard/libraries-dashboard.mjs bump <groupId:artifactId>=<version> --kind=wrapper. It rewrites the maven-id, the jar URLs and every <sha256sum>, and prints the follow-up commands.

The artifact list must match the POM

JPS resolves a repository library from its POM and requires the <verification> artifact set to equal the resolved jar set. Bazel downloads the listed URLs instead, so a mismatch passes every local Bazel build and fails the first JPS step on TeamCity ("Library 'x': not found expected artifacts"). Two rules follow:

  • A transitive artifact in a library block stays at the version the POM of the main artifact declares. Do not align it with another wrapper by editing the version.
  • To share one version across wrappers, exclude the dependency and add a module dependency on its wrapper. community/libraries/mockk/jvm/intellij.libraries.mockk.jvm.iml excludes byte-buddy-agent and depends on intellij.libraries.byte.buddy.agent.

The bump command checks a multi-artifact library against the direct dependencies of the new POM and fails on a mismatch. After a manual edit of a library block, run the same check:

bun community/build/libraries-dashboard/libraries-dashboard.mjs check <groupId:artifactId>

The check reads one POM without its parents and compares direct dependencies only. To reproduce the JPS resolution that TeamCity runs before every build, run ./build/downloadLibraries.cmd. It needs Space credentials.

Version copies outside the JPS model

After you change the version of a repository library in an *.iml or in .idea/libraries/*.xml, run the Fleet generator in the monorepo checkout:

./fleet/build/generateProjectModel.cmd dump

The Fleet generator copies the JPS library versions into fleet/build/jps-library-mappings.tsv and both fleet/kmp.MODULE.bazel files. Its check mode fails on drift.

When the dump changes a kmp.MODULE.bazel, update both Bazel lockfiles:

./bazel.cmd mod deps --lockfile_mode=update
(cd community && ./bazel.cmd mod deps --lockfile_mode=update)

The kmp module extension records its artifact list in the MODULE.bazel.lock of each module, and CI runs Bazel with --lockfile_mode=error, so a stale lockfile fails the build. bun community/build/libraries-dashboard/libraries-dashboard.mjs bump prints these commands after a bump.

Some files outside the JPS model copy a library version, and the project structure tests check each copy:

  • community/platform/jps-bootstrap/pom.xml copies every library that jps-bootstrap uses (JpsBoostrapStructureTest).
  • JetBrainsAnnotationsExternalLibraryResolver.VERSION copies org.jetbrains:annotations (IdeaUltimateProjectStructureTest).

The bump command rewrites these copies and reports a copy that still differs. After a manual version change, edit them by hand. Then run the tests that gate the Smoke Tests build:

./tests.cmd --module intellij.projectStructureTests --test 'com.intellij.ideaProjectStructure.fast.*'

These tests also check the Kotlin, Compose and LanguageTool version alignment and the unused project libraries.

BUILD.bazel Auto-Generated Sections

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:

  • Content inside auto-generated sections is overwritten by the generator
  • Content outside auto-generated sections is preserved during regeneration

Skip Generation Marker

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)

Content Modules and Wrapper Plugins

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.

Test Access to internal Declarations

A Kotlin internal declaration is visible to a test only when the test module is a friend of the production module.

The same module. A test source root of a module sees the internal declarations of the production sources. Nothing to configure. The generator adds the production target to the associates attribute of the _test_lib target.

A separate test module. Add the TestModuleProperties component to the test module .iml:

  <component name="TestModuleProperties" production-module="intellij.platform.configurationStore.impl" />

Then run ./build/jpsModelToBazel.cmd. The generator moves the production module from deps to associates, and the Kotlin compiler gets it as a friend path. For a complete example, see community/notebooks/visualization/intellij.notebooks.visualization.tests.iml.

The component holds one module. A test module cannot be a friend of two production modules, and the friendship is not transitive.

Java. Java has no internal modifier. Put the test class in the same package as a package-private declaration. For a member that carries @ApiStatus.Internal, add @VisibleForTesting or @TestOnly, because the compiler makes no check here.

Important Notes

When you need to fix missing dependencies:

  1. Edit the .iml with the repo-approved edit tool.
  2. Run bun build/jps-module.mjs register <path-to-iml> --fix-iml-eof for every changed module file.
  3. Run ./build/jpsModelToBazel.cmd so generated BUILD.bazel files match the .iml source of truth.
  4. Verify compilation or tests for the affected module.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

actions

無料概要あり

IntelliJプラグインのAnActionと登録設定を実装・変更し、表示文言やアイコンの定義、非同期処理の起動方法を整えます。

  • IDEに新しいアクションを追加したいとき
  • アクションの登録やアイコンを変更したいとき
  • 表示名と説明文の定義を整理したいとき
JetBrains/intellij-community2.1万2026年10月26日 更新

bazel-test-migration

無料概要あり

IntelliJのJPSテストモジュールをBazelへ移行し、Bazelだけで起きる失敗を依存関係や実行環境から切り分ける手順を案内します。

  • JPSテストをBazelへ移行したいとき
  • Bazelだけで起きるテスト失敗を調べたいとき
  • テストの依存関係やデータ設定を確認したいとき
JetBrains/intellij-community2.1万2026年10月26日 更新

code-style

無料概要あり

IntelliJのKotlin・Javaコードを新規作成やレビューする際に、言語の選び方、書式、型の扱い、例外処理などのプロジェクト規約に沿って整えるスキルです。

  • IntelliJ規約に沿ってKotlinを書きたいとき
  • Javaコードをレビューしたいとき
  • 例外処理やsealed型の分岐を確認したいとき
JetBrains/intellij-community2.1万2026年10月26日 更新

commits

無料概要あり

IntelliJ向けの変更を適切な単位に分け、チケットの有無に応じた形式で、理由や判断も伝わるコミットメッセージを作成・修正するスキルです。

  • チケット付き変更のメッセージを作りたいとき
  • テストやドキュメントのコミットを整理したいとき
  • 既存のコミットメッセージを修正したいとき
JetBrains/intellij-community2.1万2026年10月26日 更新

compare-python-typecheckers

無料概要あり

Pythonコードの型推論や型エラーを複数の型チェッカーで比較し、各ツールの判定と診断内容をまとめたレポートを作成します。

  • 型推論の違いを比較したいとき
  • 型エラーになるか確かめたいとき
  • 複数チェッカーの診断を見比べたいとき
JetBrains/intellij-community2.1万2026年10月26日 更新

compose-ui-architecture

無料概要あり

Compose Desktopの画面で状態や副作用をどこに持たせるか整理し、表示と判断の境界、再利用部品やリストの設計を整えます。

  • 画面とプレゼンターの責務を分けたいとき
  • UI状態の置き場所を整理したいとき
  • Effectやコルーチンの使い方を見直したいとき
JetBrains/intellij-community2.1万2026年10月26日 更新

JetBrains のスキルをすべて見る

このスキルの問題を報告する