detekt: Using detekt Gradle plugin with Kotlin 1.3.71 causes NoClassDefFoundError

Expected Behavior

Upgrading from Kotlin 1.3.70 to Kotlin 1.3.71 should not have any effect on running detekt.

Observed Behavior

detekt starts to throw:

Caused by: java.lang.NoClassDefFoundError: kotlin/ExceptionsKt
	at kotlin.io.CloseableKt.closeFinally(Closeable.kt:58)
	at io.gitlab.arturbosch.detekt.cli.runners.Runner.execute(Runner.kt:30)

Steps to Reproduce

Check out the branch at https://github.com/oss-review-toolkit/ort/pull/2409 and run ./gradlew detekt.

Context

Your Environment

  • Version of detekt used: 1.7.0
  • Version of Gradle used (if applicable): 6.2.2
  • Operating System and version: Linux / Windows
  • Link to your project (if it’s a public repository): https://github.com/oss-review-toolkit/ort

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (20 by maintainers)

Commits related to this issue

Most upvoted comments

The gradle plugin does not depend on it but the cli does which we call reflectively.

Maybe this design is something that could be fixed as part of #2680?

We do have this “theoretically” fixed with our new tooling module (even practically in the new experimental https://github.com/detekt/detekt-compiler-plugin). However until Gradle Worker’s Api supports classpath caching our hands tied here if we do not want to loose performance.

I have some further documentation in https://github.com/detekt/detekt/pull/2896.

Remember when the gradle plugin was 4x slower than the cli?

TBH, I never noticed, as I a) never compared to using the CLI manually, and b) mostly leave running detekt to CI 😁

That’s why we now cache classloaders and call detekt reflectively 😃

But still interesting if the slowdown was caused by classloader lookups!