2

I have setup Detekt in a multi module project. Below is my root level build.gradle

tasks.register("detektAll", Detekt) {
    description = "Custom Detekt build for all modules"
    parallel = true
    setSource(file(projectDir))
    config.setFrom(files("$rootDir/detekt.yml"))
    jvmTarget = "1.8"
    classpath.setFrom(project.configurations.getByName("detekt"))
    include("**/*.kt")
    exclude("**/build/**")
    reports {
        html {
            enabled = true
            destination = file("$rootDir/build/reports/detekt-results.html")
        }
        xml.enabled = false
        txt.enabled = false
    }
}

Now I am looking at setting up custom rule for which I followed this

This is what my build.gradle of customdetekt module looks like

apply plugin: 'kotlin'

repositories {
    mavenCentral()
}
dependencies {
    compileOnly "io.gitlab.arturbosch.detekt:detekt-api:1.17.1"
    testImplementation "junit:junit:4.13.2"
    testImplementation "org.assertj:assertj-core:3.20.2"
    testImplementation "io.gitlab.arturbosch.detekt:detekt-api:1.17.1"
    testImplementation "io.gitlab.arturbosch.detekt:detekt-test:1.17.1"
}

Now when I hook up custom rule module in my main module using this:

detektPlugins project(path: ':customdetekt', configuration: 'default')

I get an error:

Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method detektPlugins() for arguments [DefaultProjectDependency{dependencyProject='project ':customdetekt''

Please help

varun
  • 465
  • 6
  • 23

0 Answers0