Javi Chaqués

    Javi Chaqués

    7 months ago
    Hi, is it possible to apply the plugin with Gradle Version Catalogs?
    b

    BorzdeG

    7 months ago
    plugins {
      alias(libs.plugins.detekt)
    }
    libs.versions.toml :
    [plugins]
    detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.19.0" }
    Javi Chaqués

    Javi Chaqués

    7 months ago
    And how u declare it in subprojects?
    b

    BorzdeG

    7 months ago
    with submodules a little differently sample 1: root module:
    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:
    plugins {
      alias(libs.plugins.detekt).apply(false)
    }
    submodule:
    plugins {
      id(libs.plugins.detekt.get().pluginId)
    }
    tasks.withType<Detekt> {
      buildUponDefaultConfig = true
      config.from(rootDir.resolve("detekt/detekt.yml"))
    }
    I prefer the first example…
    Javi Chaqués

    Javi Chaqués

    7 months ago
    Ty Viktor, i will try tomorrow
    Sorry for not bein able to test it earlir.
    i'm gettint this error:
    Caused by: java.lang.NoClassDefFoundError: com/android/build/gradle/BaseExtension
    b

    BorzdeG

    6 months ago
    It seems this is a problem of a different order and is related to the Android project…