From 686e5bcea44cb7305e58c42bf35942fdf16c7e5f Mon Sep 17 00:00:00 2001 From: Hina Nakahira Date: Wed, 28 Aug 2024 03:34:14 +0900 Subject: [PATCH] Add the method to set up using a version catalog --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) 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: