เผยแพร่ไปยัง Maven Central และ SPM
แจกจ่ายผ่าน Maven Central และ Swift Package Manager
เผยแพร่ไปยัง Maven Central และ SPM เป็นบทเรียน Kotlin Multiplatform Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Kotlin Multiplatform Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Kotlin Multiplatform Academy มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Reach Both Ecosystems
Android devs pull libraries from Maven Central, while iOS devs prefer Swift Package Manager. A great KMP release serves both. 🌍
Claim Your Group
Maven Central verifies you own your group id, usually a reversed domain. This stops anyone else from publishing under your name.
group = "io.github.coddykit"Sign Your Artifacts
Central requires every file to be signed with a GPG key. The signature proves the artifact really came from you and was not tampered with.
plugins { id("signing") }Meet the Requirements
Central rejects incomplete releases. You must include sources, docs, and a POM with name, description, license, and developer details.
Point at the Central Repo
Add the Central repository with your portal credentials. The Gradle publish task then uploads every signed artifact to the staging area.
Publish and Release
Run publish to upload, then promote the staged version in the portal. After indexing, anyone can declare it as a dependency.
./gradlew publishAllPublicationsToCentralRepositoryNow Serve Swift
Swift Package Manager needs a Package.swift manifest that points at your XCFramework. This is how iOS devs add your library.
Host the Binary
Upload the zipped XCFramework to a stable url, often a GitHub release. SPM downloads it from there when someone adds the package.
Describe a Binary Target
In the manifest, declare a binaryTarget with the download url and the bundle checksum so SPM can verify the file.
.binaryTarget(
name: "Shared",
url: "...xcframework.zip",
checksum: "abc123"
)Tag a Release
SPM resolves versions from git tags. Tag the repo to match your library version so consumers can pin an exact release.
git tag 1.0.0Automate Future Releases
Manual steps drift over time. Move publishing into CI so every tagged commit signs, uploads, and updates both ecosystems the same way.
Quick Check
Let's check your release knowledge.
Recap
Sign and publish to Maven Central for Android, then host an XCFramework with a Package.swift for SPM, and automate it all in CI. 🎉
คำถามที่พบบ่อย
บทเรียน “เผยแพร่ไปยัง Maven Central และ SPM” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “เผยแพร่ไปยัง Maven Central และ SPM” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Kotlin Multiplatform Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Kotlin Multiplatform Academy มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “เผยแพร่ไปยัง Maven Central และ SPM”
แจกจ่ายผ่าน Maven Central และ Swift Package Manager คุณปฏิบัติ Kotlin Multiplatform Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Kotlin Multiplatform Academy หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Kotlin Multiplatform Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน
บทเรียน “เผยแพร่ไปยัง Maven Central และ SPM” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Kotlin Multiplatform Academy นี้ได้ไหม
ได้ บทเรียน Kotlin Multiplatform Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- กำหนดค่า maven-publish สำหรับ KMP
- เผยแพร่ XCFramework สำหรับ iOS
- การกำหนดเวอร์ชันและความเสถียรของ API
- เผยแพร่ไปยัง Maven Central และ SPM