Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point release for Kotlin 1.9.10 support #6428

Closed
credmond-git opened this issue Aug 24, 2023 · 18 comments
Closed

Point release for Kotlin 1.9.10 support #6428

credmond-git opened this issue Aug 24, 2023 · 18 comments
Labels

Comments

@credmond-git
Copy link

credmond-git commented Aug 24, 2023

Expected Behavior

Can build with Kotlin 1.9.10

Current Behavior

1.23.1 only supports Kotlin 1.9.0

Context

Hello, would it be possible to get a point release with Kotlin 1.9.10 support? This is currently blocking our projects from upgrading to Kotlin 1.9.10. Kotlin 1.9.10 has JDK 21 support and we plan on migrating our projects to JDK 21 once Gradle and detekt support it.
I along with the community would be very appreciative if we could get a point release with minimal changes quickly, that will allow us to run our Kotlin 1.9.10 builds with detekt.
Thank you for your support with the last issue #6278 to release a build to support Kotlin 1.9.0

@pedrogalan
Copy link

pedrogalan commented Aug 29, 2023

The Current Behavior section reads:

1.23.1 only supports Kotlin 1.9.10

Is that 1.9.10 correct?

@credmond-git
Copy link
Author

The current detekt 1.23.1 only supports Kotlin 1.9.0. Sorry i have corrected the bug. I also found out Kotlin 1.9.10 only supports JDK 20. So the importance of this issue is lower for me at least. Kotlin 1.9.20 should support JDK 21 so once that is released it would be more important. I am more interested in a version of Kotlin that supports JDK 21.

@BraisGabin
Copy link
Member

Detekt supports any version of detekt. You can have problems with detekt if your configuration of gradle overwrites the dependencies of detekt. But there is not any good reason to do that. So, in general, you should check your gradle configuration.

@credmond-git
Copy link
Author

credmond-git commented Aug 29, 2023

Sorry maybe i didnt provide enough information in the original bug.
When i attempt to run Detekt 1.23.1 with kotlin 1.9.10 i receive the following error:

* What went wrong:
Execution failed for task ':gameserver:detekt'.
> detekt was compiled with Kotlin 1.9.0 but is currently running with 1.9.10.
  This is not supported. See https://detekt.dev/docs/gettingstarted/gradle#dependencies for more information.

This is how i am applying detekt as part of a gradle convention plugin in buildSrc

import io.gitlab.arturbosch.detekt.Detekt

/**
 * Kotlin static code analysis using detekt.
 */

plugins {
    id("io.gitlab.arturbosch.detekt")
}

dependencies {
    detektPlugins(libs.detekt)
}

detekt {
    toolVersion = "1.23.1"
    config.setFrom(files(project.rootDir.resolve("config/detekt/config.yml")))
    debug = false
    parallel = false
}

tasks.withType<Detekt> {
    exclude(".*/resources/.*")
    exclude(".*/tmp/.*")
    exclude(".*/build/.*")

    reports {
        xml.required.set(false)
        html.required.set(true)
    }
}

This is directly related to issue #6198, but that issue is addressing the root cause, this issue is only asking for a point release.

@3flex
Copy link
Member

3flex commented Aug 31, 2023

Please see #6198 (comment) in the meantime.

Snapshots are also available and are updated to 1.9.10.

@cortinico
Copy link
Member

@credmond-git would you be able to provide a reproducer as @3flex suggested? We'll be doing a point release with 1.9.10 support in the immediate future anyway

@OksiBlack
Copy link

OksiBlack commented Sep 8, 2023

Also have the same problem.

commented here #6198 (comment)

Hyunk3l added a commit to Hyunk3l/hexagonal-architecture-kotlin-template that referenced this issue Sep 9, 2023
@OksiBlack
Copy link

Any news on the issue?

marcus-bcl added a commit to ministryofjustice/hmpps-tier that referenced this issue Oct 13, 2023
marcus-bcl added a commit to ministryofjustice/hmpps-tier that referenced this issue Oct 13, 2023
* Update all non major dependencies

* PI-1544 Downgrade Kotlin to 1.9.0 due to lack of detekt support

See detekt/detekt#6428

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@gb-jairo
Copy link

I managed to reproduce, based on some real projects I work with at my job: https://github.com/gb-jairo/detekt6428

In this case, the problem is that:

  • we use kotlin BOM 1.9.10
  • the projects have custom detekt rules that depend on detekt-cli to run. detekt-cli has a strict dependency on compiler-embeddable 1.9.0

Running any gradle command gives the following error:

 > Could not resolve org.jetbrains.kotlin:kotlin-compiler-embeddable:{strictly 1.9.0}.
     Required by:
         project : > project :detekt-custom-rules > io.gitlab.arturbosch.detekt:detekt-cli:1.23.1
      > Cannot find a version of 'org.jetbrains.kotlin:kotlin-compiler-embeddable' that satisfies the version constraints:
           Dependency path 'org.example:detekt6428:1.0-SNAPSHOT' --> 'com.example:detekt-custom-rules:1.0' (runtimeElements) --> 'io.gitlab.arturbosch.detekt:detekt-api:1.23.1' (runtimeElements) --> 'org.jetbrains.kotlin:kotlin-compiler-embeddable:1.9.0'
           Constraint path 'org.example:detekt6428:1.0-SNAPSHOT' --> 'com.example:detekt-custom-rules:1.0' (runtimeElements) --> 'org.jetbrains.kotlin:kotlin-bom:1.9.10' (platform-runtime) --> 'org.jetbrains.kotlin:kotlin-compiler-embeddable:1.9.10'
           Dependency path 'org.example:detekt6428:1.0-SNAPSHOT' --> 'com.example:detekt-custom-rules:1.0' (runtimeElements) --> 'io.gitlab.arturbosch.detekt:detekt-cli:1.23.1' (runtimeElements) --> 'org.jetbrains.kotlin:kotlin-compiler-embeddable:{strictly 1.9.0}'

@CaiqueCoelho
Copy link

I'm having the same problem, would be awesome to have a new detekt version with Kotlin 1.9.10. Right now because of this problem, we are thinking about removing detekt from our dependencies since we want to upgrade to Kotlin 1.9.10

@3flex
Copy link
Member

3flex commented Oct 25, 2023

@gb-jairo your issue is unrelated to the original issue. But in your case, there's no need to depend on detekt-cli in a custom ruleset, so remove that dependency from detekt-custom-rules. You also need to change detekt(project(":detekt-custom-rules")) to detektPlugins(project(":detekt-custom-rules")) in your root build file - detekt custom rules must be added as a plugin, not to the detekt configuration. That allows the build and detekt tasks to work.

@CaiqueCoelho you have the same issue as the original issue, or as gb-jairo? You gave the comment above a thumbs up so I'll assume that my comments your use case too.

@CaiqueCoelho
Copy link

CaiqueCoelho commented Oct 25, 2023

Hey @3flex thank you for your quick reply, my problem is related to the original problem.
I want to bump kotlin("plugin.spring") to version "1.9.10", but I'm getting the following error

Execution failed for task ':detekt'.
> detekt was compiled with Kotlin 1.9.0 but is currently running with 1.9.10.
  This is not supported. See https://detekt.dev/docs/gettingstarted/gradle#dependencies for more information.

Captura de Tela 2023-10-25 às 10 32 17
Captura de Tela 2023-10-25 às 10 32 07

The following workaround works, but we are afraid of the side effects this may have, the static analysis will run in one version and the code in another. Can you tell us if doing this would have any risks?

configurations.matching { it.name == "detekt" }.all {
    resolutionStrategy.eachDependency {
        if (requested.group == "org.jetbrains.kotlin") {
            useVersion("1.9.0")
        }
    }
}

@3flex
Copy link
Member

3flex commented Oct 25, 2023

@CaiqueCoelho please add any comments/questions on that to the original issue: #6198

@CaiqueCoelho
Copy link

Done #6198 (comment)

@gb-jairo
Copy link

it was indeed bad configuration on the company's projects 🤦
fixed with your instructions
thank you and sorry for the unrelated problem

@cortinico
Copy link
Member

Heads up that we published https://github.com/detekt/detekt/releases/tag/v1.23.2 with support for 1.9.10. Apologize for the delay.
If necessary we can make 1.23.3 with support for Kotlin 1.9.20 just after.

@bpoland
Copy link

bpoland commented Nov 15, 2023

Heads up that we published https://github.com/detekt/detekt/releases/tag/v1.23.2 with support for 1.9.10. Apologize for the delay. If necessary we can make 1.23.3 with support for Kotlin 1.9.20 just after.

👋 hey any plans to support 1.9.20 now as well? :)

It looks like the bump has already been merged, we just need a new release: #6572

@cortinico
Copy link
Member

👋 hey any plans to support 1.9.20 now as well? :)

I'll prepare a point release with support for 1.9.21 in the near future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants