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

ClassNotFoundException AtomicfuKotlinGradleSubplugin$AtomicfuKotlinGradleExtension #399

Closed
lppedd opened this issue Jan 31, 2024 · 10 comments
Labels

Comments

@lppedd
Copy link

lppedd commented Jan 31, 2024

AtomicFU 0.23.2 with Kotlin 1.9.22.
Happens when importing changes in the IDE, or when attempting to execute any Gradle task.

java.lang.NoClassDefFoundError: org/jetbrains/kotlinx/atomicfu/gradle/AtomicfuKotlinGradleSubplugin$AtomicfuKotlinGradleExtension
	at kotlinx.atomicfu.plugin.gradle.AtomicFUGradlePluginKt.applyAtomicfuCompilerPlugin(AtomicFUGradlePlugin.kt:79)
	at kotlinx.atomicfu.plugin.gradle.AtomicFUGradlePluginKt.access$applyAtomicfuCompilerPlugin(AtomicFUGradlePlugin.kt:1)
	at kotlinx.atomicfu.plugin.gradle.AtomicFUGradlePlugin.apply(AtomicFUGradlePlugin.kt:48)
	at kotlinx.atomicfu.plugin.gradle.AtomicFUGradlePlugin.apply(AtomicFUGradlePlugin.kt:42)
	...
	at Program.execute(Unknown Source)
	...
Caused by: java.lang.ClassNotFoundException: org.jetbrains.kotlinx.atomicfu.gradle.AtomicfuKotlinGradleSubplugin$AtomicfuKotlinGradleExtension
	... 214 more
@fzhinkin
Copy link
Contributor

@lppedd could you please share a reproducer?

@lppedd
Copy link
Author

lppedd commented Feb 1, 2024

@fzhinkin sure, will come up with a repro soon. Seems like I'm the only one experiencing it, so it would be cool to understand where I'm breaking it.

@willflier
Copy link

willflier commented Feb 4, 2024

I also encountered this issue when upgrading from 0.32.1 to 0.32.2.
My project is a single pure Kotlin native project.

@lppedd
Copy link
Author

lppedd commented Feb 4, 2024

Are you using some third party Gradle plugin?
Just to match what I have.

@m-sasha
Copy link

m-sasha commented Feb 4, 2024

Also experiencing this in Compose Multiplatform.

@m-sasha
Copy link

m-sasha commented Feb 4, 2024

Adding

buildscript {
    ...
    dependencies {
        ...
        classpath("org.jetbrains.kotlin:atomicfu:1.9.22")
    }
}

works around this issue.

So looks like a missing dependency in the atomicfu plugin.

@lppedd
Copy link
Author

lppedd commented Feb 5, 2024

The workaround seems to be working. Thanks @m-sasha

@fzhinkin fzhinkin added the bug label Feb 5, 2024
@fzhinkin
Copy link
Contributor

fzhinkin commented Feb 5, 2024

@m-sasha thanks!

The reproducer:

git clone https://github.com/JetBrains/compose-multiplatform-core.git --depth=1 -b v1.6.0-dev1405
./jbdeps/android-sdk/downloadAndroidSdk
sed -i -e 's@atomicFu = "0.23.1"@atomicFu = "0.23.2"@' ./gradle/libs.versions.toml
./gradlew build --stacktrace

@mvicsokolova
Copy link
Collaborator

mvicsokolova commented Feb 29, 2024

I was investigating this issue and found out that the version of atomicfu complier plugin is not resolved in the configuration of compose.
According to our last solution (#386), atomicfu-gradle-plugin provides a transitive atomicfu compiler plugin dependency and relies on the gradle version resolution. So, we provide compiler plugin with the lowest version and expect it to be resolved into the highest version present on the user's classpath.

runtimeOnly "org.jetbrains.kotlin:atomicfu:1.6.21"

I made it work by providing the higher version in the code above and I'm trying to get the core reason.

The bug is reproduced on a sample MPP project with a Native target.

@mvicsokolova
Copy link
Collaborator

This issue is fixed since 0.24.0 release

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

5 participants