From e2a0a63d8d8b4dd65a25b742ff143cc7536e8468 Mon Sep 17 00:00:00 2001 From: Hina Nakahira Date: Wed, 30 Oct 2024 06:18:54 +0900 Subject: [PATCH] Add Version Catalog Setup Instructions in README (#770) * Add the method to set up using a version catalog * Update CHANGELOG.md --------- Co-authored-by: Hina Nakahira Co-authored-by: Jonathan Leitschuh --- CHANGELOG.md | 3 +++ README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dc41b2e..1cd833d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - Bump al-cheb/configure-pagefile-action from 1.3 to 1.4 [#780](https://github.com/JLLeitschuh/ktlint-gradle/pull/780) - Update version for jgit to 5.13.3.202401111512-r [#766](https://github.com/JLLeitschuh/ktlint-gradle/pull/766) - builds: remove specific lintian version, as latest ubuntu is now a new version + [#767](https://github.com/JLLeitschuh/ktlint-gradle/pull/767) +- docs: add Version Catalog setup instructions in README + [#770](https://github.com/JLLeitschuh/ktlint-gradle/pull/770) [#767](https://github.com/JLLeitschuh/ktlint-gradle/pull/767) ### Fixed diff --git a/README.md b/README.md index 236a27e5..5336018e 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,49 @@ repositories { ``` +#### Using Version Catalog + +To configure the plugin using a version catalog, first, add the following entries to your libs.versions.toml file: + +```toml +[versions] +ktlint = "" + +[plugins] +ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" } +``` + +Next, apply it to your project: + +
+Groovy + +```groovy +plugins { + alias(libs.plugins.ktlint) +} + +repositories { + // Required to download KtLint + mavenCentral() +} +``` +
+
+Kotlin + +```kotlin +plugins { + alias(libs.plugins.ktlint) +} + +repositories { + // Required to download KtLint + mavenCentral() +} +``` +
+ #### Using legacy apply method Build script snippet for use in all Gradle versions: