Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Set an explicit version when registering compiler plugin #49

Merged
merged 1 commit into from
Aug 15, 2021

Conversation

3flex
Copy link
Member

@3flex 3flex commented Aug 15, 2021

When the version isn't set the Kotlin Gradle plugin will attempt to resolve detekt-compiler-plugin using the version of the Kotlin Gradle plugin that is in use e.g. if Kotlin version is 1.4.31 the plugin will attempt to download detekt-compiler-plugin-1.4.31.pom from registered repositories.

When the version isn't set the Kotlin Gradle plugin will attempt to resolve
detekt-compiler-plugin using the version of the Kotlin Gradle plugin that
is in use e.g. if Kotlin version is 1.4.31 the plugin will attempt to
download detekt-compiler-plugin-1.4.31.pom from registered repositories.
@cortinico
Copy link
Member

When the version isn't set

I'm missing why this could be the case. How can you not set the version?

@3flex
Copy link
Member Author

3flex commented Aug 15, 2021

The artifact coordinates returned by getPluginArtifact() are used here to create a dependency and put it on the Kotlin compiler plugin classpath:

https://github.com/JetBrains/kotlin/blob/v1.4.31/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/SubpluginEnvironment.kt#L69-L71

When the version isn't explicitly set the version used will be the version of the Kotlin Gradle plugin. I assume this is mostly to support other Kotlin plugins which default to the same version as declared by the Kotlin Gradle plugin itself and therefore don't need a version explicitly set.

I'm not sure why this issue wasn't exposed in previous testing but it might have something to do with the specific configuration of my build, though I didn't dig to find out.

@chao2zhang chao2zhang merged commit d32fe53 into detekt:main Aug 15, 2021
@3flex 3flex deleted the version branch August 15, 2021 21:40
cortinico added a commit that referenced this pull request Oct 17, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants