Skip to content

fix(build): keep kotlin-test-junit on the sample JVM test classpath - #181

Merged
xelon-ua merged 1 commit into
mainfrom
table-sample-tests-fail-to-compile-when-gradle-runs-many-tas
Dec 3, 2026
Merged

xelon-ua merged 1 commit into
mainfrom
table-sample-tests-fail-to-compile-when-gradle-runs-many-tas

Conversation

@xelon-ua

@xelon-ua xelon-ua commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Summary

:table-sample:compileTestKotlinJvm failed with Unresolved reference 'Test' when the same Gradle run also compiled the iOS tests.

Root cause: kotlin-test-annotations-common in commonTest makes the Kotlin Gradle plugin add a second kotlin-test to that configuration on its first resolution. The plugin then selects the JVM framework variant with singleOrNull() over all inherited kotlin-test dependencies. If the iOS test classpath resolves first, it finds two, skips the capability, and kotlin-test-junit drops off the JVM test classpath.

Changes

  • Remove the obsolete kotlin-test-annotations-common dependency from table-sample (kotlin-test covers it) and its now unused catalog entry.

Testing

  • Minimal trigger before the fix: :table-sample:compileTestKotlinIosSimulatorArm64 :table-sample:compileTestKotlinJvm; the resolved JVM test classpath had no kotlin-test-junit. It does after the fix.
  • ./gradlew qualityCheck compileCommonMainKotlinMetadata compileAndroidMain compileKotlinJs compileKotlinWasmJs compileTestKotlinIosSimulatorArm64 :table-sample-android:assembleDebug jvmTest :table-sample:cleanCompileTestKotlinJvm --continue --no-build-cache: failed before, passes now.
  • :table-sample:compileTestKotlinJs :table-sample:compileTestKotlinWasmJs pass.

The legacy kotlin-test-annotations-common dependency makes the Kotlin
Gradle plugin add a second kotlin-test to commonTest when that
configuration is first resolved. The plugin picks the JVM framework
variant with singleOrNull(), so if another target's test classpath
(iOS) is resolved before jvmTest, it sees two entries, adds no
capability and kotlin.test.Test is missing.

kotlin-test already provides the common annotations.
@xelon-ua
xelon-ua merged commit 32dca09 into main Dec 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant