แค็ตตาล็อกรุ่นส่วนพึ่งพาและแพลตฟอร์ม
รวมศูนย์และบังคับใช้รุ่นของส่วนพึ่งพาทั่วการสร้างหลายโมดูลขนาดใหญ่ด้วยแค็ตตาล็อกรุ่นและแพลตฟอร์ม Gradle (BOM) เพื่อความสอดคล้องและการกำกับดูแล
แค็ตตาล็อกรุ่นส่วนพึ่งพาและแพลตฟอร์ม เป็นบทเรียน Groovy & Gradle: JVM Automation and Build Engineering ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน 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
เรียนรู้ Groovy ด้วย AI tutor — ฟรี
เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป
- คอร์ส
- 12
- บทเรียน
- 48
คำถามที่พบบ่อย
บทเรียน “แค็ตตาล็อกรุ่นส่วนพึ่งพาและแพลตฟอร์ม” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “แค็ตตาล็อกรุ่นส่วนพึ่งพาและแพลตฟอร์ม” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส 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 ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Groovy & Gradle: JVM Automation and Build Engineering หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Groovy & Gradle: JVM Automation and Build Engineering บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน
บทเรียน “แค็ตตาล็อกรุ่นส่วนพึ่งพาและแพลตฟอร์ม” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Groovy & Gradle: JVM Automation and Build Engineering นี้ได้ไหม
ได้ บทเรียน Groovy & Gradle: JVM Automation and Build Engineering ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- การสแกนการสร้างและข้อมูลเชิงลึกของ Gradle
- การจัดการความปลอดภัยและข้อมูลรับรอง
- ปลั๊กอินตามแบบแผนและตรรกะการสร้าง
- แค็ตตาล็อกรุ่นส่วนพึ่งพาและแพลตฟอร์ม