依存関係バージョンカタログとプラットフォーム
バージョンカタログとGradleプラットフォーム(BOM)を使って、大規模なマルチモジュールビルド全体の依存関係バージョンを一元化・統制します。
「依存関係バージョンカタログとプラットフォーム」はCoddyKit上の無料Groovy & Gradle: JVM Automation and Build Engineeringレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはGroovy & Gradle: JVM Automation and Build Engineering学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Groovy & Gradle: JVM Automation and Build Engineeringコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
The Version Drift Problem
In enterprise builds with dozens of modules, the same library can end up declared with different versions, causing subtle runtime conflicts. Centralizing versions prevents this drift.
What is a Version Catalog?
A version catalog is a single typesafe list of dependencies and versions, defined in gradle/libs.versions.toml and shared across all modules.
The TOML Format
The catalog has sections for versions, libraries, and plugins.
[versions]
guava = "33.0.0-jre"
[libraries]
guava = { module = "com.google.guava:guava", version.ref = "guava" }Using Catalog Entries
In a build script you reference the typesafe accessor, getting IDE completion and a compile error if the name is wrong.
dependencies {
implementation(libs.guava)
}Bundles
Group related libraries into a bundle so modules add them all at once.
[bundles]
networking = ["retrofit", "okhttp"]Plugin Versions in the Catalog
Catalogs can also pin plugin versions, keeping the whole toolchain consistent.
[plugins]
spring = { id = "org.springframework.boot", version = "3.2.0" }What is a Platform?
A platform (Maven BOM) constrains versions of transitive dependencies without adding them. It governs what version wins during resolution.
Applying a Platform
Import a BOM with the platform() notation; aligned dependencies inherit its managed versions.
dependencies {
implementation(platform("org.springframework.boot:spring-boot-dependencies:3.2.0"))
implementation("org.springframework:spring-web")
}Publishing Your Own Platform
Large orgs publish an internal platform module so every team aligns on approved versions automatically.
plugins { id("java-platform") }
dependencies {
constraints {
api("com.acme:logging:2.1.0")
}
}Catalog vs Platform
They complement each other:
- Catalog: what you type when declaring dependencies
- Platform: which transitive versions are allowed at resolution
Governance Benefits
Together they give central teams control: upgrade a library once, and every module follows, with reviewable changes in version control.
Quick Check
Test your understanding of catalogs and platforms.
Recap
You learned centralized version management:
- Catalog in
libs.versions.tomlgives typesafe accessors - Bundles group related libraries
- Platforms (BOMs) constrain transitive versions
- Together they enforce consistency across large builds
AI チューターと学ぶ Groovy — 無料
ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。
- コース
- 12
- レッスン
- 48
よくある質問
「依存関係バージョンカタログとプラットフォーム」レッスンは無料ですか?
はい。「依存関係バージョンカタログとプラットフォーム」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Groovy & Gradle: JVM Automation and Build Engineeringコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Groovy & Gradle: JVM Automation and Build Engineeringコースには全4レッスンが含まれています。
「依存関係バージョンカタログとプラットフォーム」で何を学びますか?
バージョンカタログとGradleプラットフォーム(BOM)を使って、大規模なマルチモジュールビルド全体の依存関係バージョンを一元化・統制します。 ブラウザで直接実行するハンズオンコードでGroovy & Gradle: JVM Automation and Build Engineeringを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Groovy & Gradle: JVM Automation and Build Engineeringを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのGroovy & Gradle: JVM Automation and Build Engineeringは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「依存関係バージョンカタログとプラットフォーム」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このGroovy & Gradle: JVM Automation and Build Engineeringレッスンでコードを書いて実行できますか?
はい。すべてのGroovy & Gradle: JVM Automation and Build Engineeringレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- Gradle Build Scansと分析
- セキュリティと認証情報の管理
- コンベンションプラグインとビルドロジック
- 依存関係バージョンカタログとプラットフォーム