Hi, is it possible to apply the plugin with Gradle...
# detekt
j
Hi, is it possible to apply the plugin with Gradle Version Catalogs?
b
Copy code
plugins {
  alias(libs.plugins.detekt)
}
libs.versions.toml :
Copy code
[plugins]
detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.19.0" }
☝️ 1
j
And how u declare it in subprojects?
b
with submodules a little differently sample 1: root module:
Copy code
plugins {
  alias(libs.plugins.detekt).apply(false)
}

subprojects {
  project.pluginManager.withPlugin(rootProject.libs.plugins.kotlin.jvm.get().pluginId) {
    plugins.apply(rootProject.libs.plugins.detekt.get().pluginId)
    tasks.withType<Detekt> {
      buildUponDefaultConfig = true
      config.from(rootDir.resolve("detekt/detekt.yml"))
    }
  }
}
sample 2: root module:
Copy code
plugins {
  alias(libs.plugins.detekt).apply(false)
}
submodule:
Copy code
plugins {
  id(libs.plugins.detekt.get().pluginId)
}
tasks.withType<Detekt> {
  buildUponDefaultConfig = true
  config.from(rootDir.resolve("detekt/detekt.yml"))
}
I prefer the first example…
j
Ty Viktor, i will try tomorrow
Sorry for not bein able to test it earlir.
i'm gettint this error:
Copy code
Caused by: java.lang.NoClassDefFoundError: com/android/build/gradle/BaseExtension
b
It seems this is a problem of a different order and is related to the Android project…