Igor Wojda
11/05/2023, 12:32 PMKonsist library. This lib is added as test dependency to testImplementation :
testImplementation("com.lemonappdev:konsist:0.13.0")
Recently author of github-workflows has reported a crash after upgrading Kotlin 1.9.10 to `1.9.20`:
https://github.com/typesafegithub/github-workflows-kt/actions/runs/6732452661/job/18299225205?pr=1066
Under the hood this crash translates to:
NoSuchMethodError: 'org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
It looks like crash is a result of old version of kotlin:kotlin-compiler being used in the github-workflows project.
This crash can be fixed by adding the
testImplementation("org.jetbrains.kotlin:kotlin-compiler:1.9.20") dependency to the github-workflows project (branch renovate/kotlin-monorepo branch, file" library/build.gradle.kts).
Konsist works on other projects using Kotlin 1.9.20 so I am not sure why this is failing in this particular project:
Obviously I would like users not to be forced to add extra kotlin-compiler dependency.
Here is the POM of recent Konsist lib release:
repo1.maven.org/maven2/com/lemonappdev/konsist/0.13.0/konsist-0.13.0.pom
Pom file contains kotlin-compiler dependency:
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-compiler</artifactId>
<version>1.9.10</version>
<scope>runtime</scope>
</dependency>
... however this dependency seems to be ignored.
I have updated Konsist artifact locally and changed the Kotlin version to 1.9.20 and tried to change scope of kotlin-compiler to compile in pom file, however this still does not solve the issue. It looks like without explicit dependency to testImplementation("org.jetbrains.kotlin:kotlin-compiler:1.9.20") the github-workflows build is failing.
I wonder how kotlin-compiler dependency should be exposed by the Konsist library to make it always work (without explicitly adding this dependency to the 3rd party project)? (dependency required only for test source set).Is the scope incorrect or is there something more to consider here?