4

I'm trying to write custom gradle plugin (for my self) that is using many external plugins like (detekt)... But it seems that this is not possible, I can write only internal tasks that are created by my plugin... It looks like that I have to build external plugin my self and use it as a jar file or to create task that is using for example detekt core API - and this is something I don't want to do...

How can I apply for example detekt library and task configuration to my custom plugin?

package com.urosjarc.gradle.tdd

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.existing
import org.gradle.testing.jacoco.plugins.JacocoPlugin

class TddPlugin : Plugin<Project> {
    override fun apply(target: Project) { with(target){

        plugins.run {
            apply(JacocoPlugin::class)
            apply("io.gitlab.arturbosch.detekt")
        }

        task("hello").doLast {
            println("Hello World from plugins! :D")
        }

        val detekt by tasks.existing(Detekt::class) {
            reports {
                html.destination = "$buildDir/detekt"
                xml.enabled = false
            }
        }
    }}
}
  • Not familiar with this product, but [does this relate?](https://plugins.gradle.org/plugin/io.gitlab.arturbosch.detekt) – Jimmy Smith Feb 05 '20 at 19:49

0 Answers0