https://kotlinlang.org logo
#detekt
Title
# detekt
s

Sourabh Rawat

11/25/2020, 9:15 AM
I was trying to use precompiled gradle plugins in buildSrc but it is giving me following error with v1.2.2
Copy code
Caused by: org.gradle.api.GradleException: Error resolving plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.3.61']
	at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.resolveToFoundResult(DefaultPluginRequestApplicator.java:207)
	... 155 more
Caused by: org.gradle.plugin.management.internal.InvalidPluginRequestException: Plugin request for plugin already on the classpath must not include a version
It works if I upgrade detekt to latest one. But I want to know why it is failing in older version, since upgrading the plugin will require more than a few changes and this is a production project Seems like it is failing on latest one as well
src/main/kotlin/detekt_config.gradle.kts
in buildSrc
Copy code
plugins {
    id("io.gitlab.arturbosch.detekt")
}

detekt {
    toolVersion = "1.15.0-RC1"
    config = files("config/detekt/detekt.yml")
}

dependencies {
    detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.15.0-RC1")
}
build.gradle.kts
in buildSrc
Copy code
repositories {
    jcenter()
    gradlePluginPortal()
}

plugins {
    `kotlin-dsl`
}

dependencies {
    implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.2.2")
}
main project
build.gradle.kts
Copy code
plugins {
    id("org.springframework.boot") version BuildPlugins.Versions.springBootPlugin
    id("io.spring.dependency-management") version BuildPlugins.Versions.springDI
    kotlin("jvm") version BuildPlugins.Versions.kotlin
    kotlin("plugin.spring") version BuildPlugins.Versions.kotlin
    kotlin("plugin.noarg") version BuildPlugins.Versions.kotlin
    detekt_config
}
z

zmunm

11/25/2020, 9:32 AM
your toolVersion is 1.15.0-RC1 but implemented detekt-gradle-plugin is 1.2.2 Maybe matching the two will help
☝️ 1
b

Brais Gabin

11/26/2020, 7:49 AM
Why will it requiere changes? You can use the baseline feature so any current issue is accepted. This way you accept the current debt but you don't allow any new
s

Sourabh Rawat

11/26/2020, 8:54 AM
@zmunm ofc I'm changing the version in both places 🙃
@Brais Gabin I'll take a look into baseline feature. Thanks
31 Views