0Pricing
Groovy & Gradle: JVM Automation and Build Engineering · Pelajaran

Katalog Versi Dependensi dan Platform

Pusatkan dan tegakkan versi dependensi di seluruh build besar multi-modul menggunakan katalog versi dan platform Gradle (BOM) demi konsistensi serta tata kelola.

Katalog Versi Dependensi dan Platform adalah pelajaran Groovy & Gradle: JVM Automation and Build Engineering gratis di CoddyKit. Ini adalah pelajaran 4 dari 4. Kamu bisa membaca pelajaran lengkapnya di bawah secara gratis — lalu praktikkan langsung di browser dengan editor kode bawaan dan tutor AI 24/7. Ini adalah bagian dari jalur belajar Groovy & Gradle: JVM Automation and Build Engineering, dan progresmu tersinkronisasi di web dan aplikasi CoddyKit. Kursus Groovy & Gradle: JVM Automation and Build Engineering mencakup 4 pelajaran total.

Bagian dari pelajaran ini belum diterjemahkan dan ditampilkan dalam bahasa Inggris.

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.toml gives typesafe accessors
  • Bundles group related libraries
  • Platforms (BOMs) constrain transitive versions
  • Together they enforce consistency across large builds

Pertanyaan yang Sering Diajukan

Apakah pelajaran “Katalog Versi Dependensi dan Platform” gratis?

Ya — teks lengkap “Katalog Versi Dependensi dan Platform” gratis dibaca di sini di web. Untuk praktiknya secara interaktif (editor kode bawaan dan tutor AI 24/7) dan buka sisa kursus Groovy & Gradle: JVM Automation and Build Engineering, upgrade ke CoddyKit PRO. Kursus Groovy & Gradle: JVM Automation and Build Engineering mencakup 4 pelajaran total.

Apa yang akan aku pelajari di “Katalog Versi Dependensi dan Platform”?

Pusatkan dan tegakkan versi dependensi di seluruh build besar multi-modul menggunakan katalog versi dan platform Gradle (BOM) demi konsistensi serta tata kelola. Kamu berlatih Groovy & Gradle: JVM Automation and Build Engineering dengan kode praktik yang langsung kamu jalankan di browser, dan tutor AI 24/7 menjawab pertanyaanmu saat kamu mengerjakan pelajaran ini.

Apakah aku perlu pengalaman untuk memulai Groovy & Gradle: JVM Automation and Build Engineering?

Tidak diperlukan pengalaman sebelumnya. Groovy & Gradle: JVM Automation and Build Engineering di CoddyKit dirancang untuk pemula hingga pelajar tingkat lanjut, jadi kamu bisa memulai di sini atau dari awal dan belajar sesuai kecepatan kamu sendiri. Ini adalah pelajaran 4 dari 4.

Berapa lama pelajaran “Katalog Versi Dependensi dan Platform” memakan waktu?

Sebagian besar pelajaran CoddyKit memakan waktu sekitar 5–10 menit. Setiap pelajaran ringkas dan interaktif, jadi kamu membuat kemajuan stabil dan melanjutkan dari tempat kamu tinggalkan di web dan aplikasi.

Bisakah aku menulis dan menjalankan kode dalam pelajaran Groovy & Gradle: JVM Automation and Build Engineering ini?

Ya. Setiap pelajaran Groovy & Gradle: JVM Automation and Build Engineering menyertakan editor kode bawaan, jadi kamu menulis dan menjalankan kode nyata langsung di browser dan mendapatkan umpan balik AI instan — tidak diperlukan penyiapan lokal.

Semua pelajaran dalam kursus ini

  1. Gradle Build Scan & Wawasan
  2. Keamanan & Pengelolaan Kredensial
  3. Plugin Konvensi & Logika Pembangunan
  4. Katalog Versi Dependensi dan Platform
← Kembali ke Groovy & Gradle: JVM Automation and Build Engineering