https://kotlinlang.org logo
Join Slack
Powered by
# gradle
  • r

    Rafs

    07/02/2025, 10:11 PM
    During project configuration on Gitlab CI, I get this exact error. This doesn't happen locally so it's becoming impossible to debug. The error message is the same when i add
    --debug
    flag to the build stage. The environment is Java 17 and latest version of Kotlin and Compose
    Copy code
    a problem occurred configuring project ':module-name'.
    > Failed to notify project evaluation listener. 
         > Invalid version:
    The error is very vague and I am struggling to figure out what version of what in particular is invalid. I am wondering if anyone has encountered this in the past.
    v
    • 2
    • 1
  • h

    Hugo Costa

    07/03/2025, 6:50 AM
    Hello, we're testing Gradle 9-RC1 internally where we're still on
    2.0.21
    (don't ask) which is failing with
    Copy code
    java.lang.NoSuchMethodError: 'org.gradle.api.provider.Provider org.gradle.api.provider.Provider.forUseAtConfigurationTime()'
    	at org.jetbrains.kotlin.gradle.plugin.internal.ConfigurationTimePropertiesAccessorG6.usedAtConfigurationTime(ConfigurationTimePropertiesAccessorG6.kt:19)
    	at org.jetbrains.kotlin.gradle.plugin.internal.ConfigurationTimePropertiesAccessorKt.usedAtConfigurationTime(ConfigurationTimePropertiesAccessor.kt:49)
    	at org.jetbrains.kotlin.gradle.utils.FileUtilsKt.getLocalProperties(fileUtils.kt:145)
    	at org.jetbrains.kotlin.gradle.internal.properties.PropertiesBuildService$Companion$registerIfAbsent$1.execute(PropertiesBuildService.kt:168)
    	at org.jetbrains.kotlin.gradle.internal.properties.PropertiesBuildService$Companion$registerIfAbsent$1.execute(PropertiesBuildService.kt:167)
    Just want to confirm - is this a failure you'd expect in the
    gradle85
    variant?
    t
    • 2
    • 22
  • a

    Arjan van Wieringen

    07/08/2025, 9:08 AM
    I have created a Gradle plugin where I use the newest Ktor Client to download something in a task. I use
    runBlocking
    to start the coroutine scope and initiate the client. I include the latest Coroutines Core dependency in my Gradle plugin build script. When using this task in a target project I get the following error:
    Copy code
    A problem occurred configuring project ':examples:asset-mapper'.
    > Could not create task ':examples:asset-mapper:downloadCDNAssets'.
       > kotlin/coroutines/jvm/internal/SpillingKt
    
    ....
    Caused by: java.lang.NoClassDefFoundError: kotlin/coroutines/jvm/internal/SpillingKt
    	at nl.helicotech.ktorize.jsdelivr.JsDelivrClient.packageMetadata(JsDelivrClient.kt:91)
    	at nl.helicotech.ktorize.plugin.cdn.jsdelivr.JSDelivrDownloader$get$1.invokeSuspend(JSDelivrDownloader.kt:19)
    	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
    	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:263)
    	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:94)
    	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:70)
    	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
    	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    	at nl.helicotech.ktorize.plugin.cdn.jsdelivr.JSDelivrDownloader.get(JSDelivrDownloader.kt:17)
    	at nl.helicotech.ktorize.plugin.cdn.Downloaders.get(Downloader.kt:16)
    	at nl.helicotech.ktorize.plugin.cdn.CDNPlugin.apply$lambda$3(CDNPlugin.kt:37)
    	at nl.helicotech.ktorize.plugin.cdn.CDNPlugin.apply$lambda$4(CDNPlugin.kt:26)
    	at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:66)
    	at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:66)
    	at org.gradle.internal.code.DefaultUserCodeApplicationContext$CurrentApplication$1.execute(DefaultUserCodeApplicationContext.java:124)
    	at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction$1.run(DefaultCollectionCallbackActionDecorator.java:110)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:30)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:27)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:67)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:60)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:167)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:60)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:48)
    	at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction.execute(DefaultCollectionCallbackActionDecorator.java:107)
    	at org.gradle.internal.ImmutableActionSet$SetWithManyActions.execute(ImmutableActionSet.java:329)
    	at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:280)
    	at org.gradle.api.internal.DefaultNamedDomainObjectCollection.doAdd(DefaultNamedDomainObjectCollection.java:125)
    	at org.gradle.api.internal.DefaultNamedDomainObjectCollection$AbstractDomainObjectCreatingProvider.tryCreate(DefaultNamedDomainObjectCollection.java:1008)
    	... 154 more
    Caused by: java.lang.ClassNotFoundException: kotlin.coroutines.jvm.internal.SpillingKt
    	at org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader.findClass(VisitableURLClassLoader.java:189)
    	... 184 more
    It can not find the SpillingKt class. I have no idea why this is but my guess is Kotlin version differences/requirements between what Gradle plugins support and what version I am on.
    v
    • 2
    • 1
  • e

    eygraber

    07/08/2025, 10:16 AM
    Are there any plans to offer an API similar to Android's variants?
    t
    j
    c
    • 4
    • 5
  • s

    Sebastian Lehrbaum

    07/09/2025, 1:17 PM
    Hi together, at my company, when we enable the gradle configuration cache (default enabled in gradle 9), we get an error from the compileKotlin task.
    Copy code
    Execution failed for task ':compileKotlin'.
    > Error while evaluating property 'disableMultiModuleIC' of task ':compileKotlin'.
       > Invocation of 'Task.project' by task ':compileKotlin' at execution time is unsupported with the configuration cache.
    We traced it back to this line in the Kotlin compiler: https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plug[…]ommon/kotlin/org/jetbrains/kotlin/gradle/tasks/KotlinCompile.kt It only happens on jenkins, locally all is fine. It is reproducible and happens in a cleaned workspace (also in a dirty one). We are unsure why the error only happens on jenkins. Maybe a timing issue with the lazy? Any idea what that could be?
    t
    v
    +3
    • 6
    • 26
  • j

    Josh Friend

    07/09/2025, 2:08 PM
    Is there a way to suppress
    Opt-in requirement marker XXX is unresolved
    warnings? You apparently can't add opt-in args after dependency resolution because freeCompilerArgs is frozen so it makes convention plugins quite annoying because you have to either
    @OptIn
    everywhere in source, or deal with hundreds of useless build warnings if you opt in with your conventions plugins.
    t
    • 2
    • 5
  • e

    Emily

    07/13/2025, 12:42 PM
    Hi, what is the best way to centralize test dependencies or non-runtime dependencies? I have a project that currently centralizes a bunch of dependencies with the api configuration so that I can just add it with
    implementation(project(":myLibs"))
    , but I'd like to be able to do something akin to
    testImplementation(project(":myLibs", configuration = "testImplementation"))
    or
    compileOnly(project(":myLibs", configuration = "compileOnly"))
    . I've already tried the latter and know that doesn't work. I know it could be done with a convention plugin, but I'm asking here in case there are better options.
    v
    • 2
    • 2
  • p

    PHondogo

    07/21/2025, 8:15 PM
    Does Kotlin Gradle plugin support configuration cache? Getting
    Copy code
    Task `:my-project:jsBrowserProductionWebpack` of type `org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack`: cannot serialize object of type 'org.gradle.api.internal.project.DefaultProject', a subtype of 'org.gradle.api.Project', as these are not supported with the configuration cache.
    h
    a
    • 3
    • 4
  • o

    Oleg Nenashev

    07/26/2025, 9:44 AM
    gsoc All five Gradle-focused Google Summer of Code projects in the Kotlin Foundation have passed the mid-term evaluation and continue to the next phase! All contributors have delivered some releases and pull requests, including new Gradle plugins, IDEA plugin improvements and compatibility patches to existing plugins like Detekt or Nebula Lint Plugin. Here are the raw videos for the projects below. We will be sharing refined versions in the blog post(s) later: • Better Reporting and Parallel Verifications in the IntelliJ Platform Gradle Plugin – Gradle Reporting and Parallel Verifications by @alaje • Enhanced Kotlin Code Quality Reporting: Gradle Problems API integration for the Detekt plugin by @Vanessa Johnson • Gradle Convention Plugin for Developing Jenkins Plugins by @Aarav Mahajan • Improving Configuration Cache compatibility in key Gradle plugins, including Nebula Lint Plugin by @Nouran • Improving Maven Central publishing DevEx for Gradle - support for org defaults and pre-publishing artifact verification by @Yongjun Hong If you are interested in learning more, see the Project Pages and the List of GSoC 2025 Deliverables—Mid-Term Evaluation, and join the discussion channels linked there (in the second google doc). In the next coding phase community feedback from interested adopters is crucial, and we will appreciate your participation! Kudos to all contributors and @Jakub Chrzanowski, @sghill, @rahulsom, @Rafael Chaves, @bamboo , @Reinhold Degenfellner, @donat for being mentors this year! P.S: There are 2 more projects for Kotlin Language Server and the KMP for Gemini that have also successfully passed the evaluation. Stay tuned for the wider announcement!
    👏 8
  • u

    ursus

    07/29/2025, 10:44 PM
    Is generating a new module with certain defaults, structure etc - is this a gradle job?
    not kotlin but kotlin colored 1
    e
    • 2
    • 2
  • u

    ursus

    07/31/2025, 1:18 AM
    If I want to build & deploy multiple apps. But I'd rather they all get built first (to see they do build), and only if that passes start deploying Is this a "mess with task graph job" or simply 2
    ./gradlew ..
    commands? The latter seems more explicit but idk, is it idiomatic?
    not kotlin but kotlin colored 1
    v
    c
    • 3
    • 3
  • a

    alllex

    08/02/2025, 4:46 PM
    📣
    Gradle 9.0.0
    is out! 🔧 Configuration Cache is now the recommended execution mode ☕ Gradle requires Java 17+ to run, but you can still build with older Java versions 💼 Updated to Kotlin 2.2 and Groovy 4.0. It means new language features in the DSLs ⚡ Improved Kotlin DSL build script compilation avoidance What’s new in Gradle 9? https://gradle.org/whats-new/gradle-9/ Release video:

    https://www.youtube.com/watch?v=GJGBPwfhpdo▾

    Full changelog: https://docs.gradle.org/9.0.0/release-notes.html Please report any issue on GitHub - https://github.com/gradle/gradle/issues !
    🚀 6
    ❤️ 3
    🎉 2
    gradle intensifies 15
  • s

    Sargun Vohra

    08/04/2025, 6:24 PM
    Say I have a KMP library where the JVM target requires JNI and therefore needs to publish the native shared object. There's up to six native binaries in total: Windows, macOS, Linux, each for x64 and ARM. What's the best way to publish this library to Maven Central with the native binaries easily available for the user of the library? • In a plain JVM project I might use feature variants, but I think KMP doesn't support that. • I could publish each native binary in a jar with a special classifier, so for example the jar is
    library-x.y.z-natives_os_arch.jar
    . The user of the library would depend on the library (without classifier) plus one or more natives , depending on which platforms they support. • I could publish all the native binaries outside of Maven Central, and document for the user how to add them to their app. But this seems hard to use, essentially introducing some nonstandard dependency management. Or, I could publish a small gradle plugin that configures this for the user. • I could publish my library as a single fat jar with all six binaries included. But that feels like it unnecessarily inflates the binary size. And building this one jar in CI would get complicated, with build steps on multiple different runners all coalescing into one jar. How is this typically done in the JVM and the KMP world? For example, I assume Compose Multiplatform itself includes some native libraries (skia?). But as a user I don't have to do anything special to depend on it, perhaps because the Compose gradle plugin deals with it for me? Are there some good examples out there that don't come with an associated plugin? The second approach (classifiers) seems like the most viable to me. But I'm unclear on: • What would the gradle config look like for such a library? • What would the configuration look like for the user of the library? • Would they be able to use a version catalog with these special artifacts? My goal with this KMP library is to support Kotlin/JVM and Android with JNI, and Kotlin/Native with cinterop. But for now, I'm focusing on the (non-android) JVM build only.
    e
    v
    • 3
    • 34
  • j

    Joel Denke

    08/07/2025, 5:29 AM
    Whats the recommended way in KMP projects to inject server config, like server domain? Like localhost vs actual domain in debug vs production. In Android often used build types or Build config, but that doesnt exist really in KMP from what I know of. Is there a good way of dealing with this?
    g
    m
    c
    • 4
    • 36
  • m

    mbonnin

    08/08/2025, 1:34 PM
    Is there a reason
    kotlin.abiValidation
    couldn't be a type safe
    fun abiValidation(action: Action<AbiValidationExtension>)
    ? I get that working with extensions is best for top level blocks because of Groovy interop but is it also needed for nested blocks? Reason I'm asking is it hurts discoverability when working in convention plugins where generated accessors are not always available.
    v
    • 2
    • 5
  • o

    Oleg Nenashev

    08/14/2025, 2:24 PM
    📣 Gradle 9.1.0 RC1 is out and ready for testing 🔬 https://docs.gradle.org/9.1.0-rc-1/release-notes.html ☕ Full Java 25 support 🔧 Native task graph visualization 💼 Enhanced console output 🐛 Bug fixes Please report any discovered issue on GitHub!
    🎉 6
    gradle intensifies 5
  • l

    loke

    08/18/2025, 4:24 PM
    I have a project where one of the submodules uses the preview vector API, so whenever the code is run, it needs a specific
    -module
    argument. Is there a way to specify this in the module's gradle file such that it is picked up by all dependent modules automatically? As it stands, I have to add it everywhere manually, and that's annoying.
    v
    • 2
    • 2
  • t

    tony

    08/18/2025, 5:24 PM
    can I tell KGP to stop doing this? https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plug[…]ommon/kotlin/org/jetbrains/kotlin/gradle/tasks/KotlinCompile.kt it's breaking our builds with CC enabled
    plus one 1
    h
    • 2
    • 3
  • s

    Slackbot

    08/19/2025, 11:14 AM
    This message was deleted.
    🧵 4
    m
    a
    • 3
    • 2
  • e

    eygraber

    08/19/2025, 3:01 PM
    I started seeing an issue in my project after enabling the configuration cache where KGP's allTests task hangs and never completes when the configuration cache wasn't able to be reused. I have some thread dumps, but I'm not sure if I should file an issue with Gradle or Kotlin. Any pointers?
    a
    t
    • 3
    • 16
  • m

    mbonnin

    08/19/2025, 3:57 PM
    Can I ask KGP to set
    kotlin-stdlib
    version of my project to a specific version for the JVM but not for other targets? I have used
    coreLibrariesVersion
    in the past but this has a lot of side effects, especially for targets like JS/Wasm that currently require their
    kotlin-stdlib
    to be aligned with the compiler version.
    t
    • 2
    • 24
  • e

    Edgar Avuzi

    08/20/2025, 7:54 AM
    Curious what's the reasoning behind not having
    Copy code
    fun DependencyHandlerScope.implementations(vararg deps: Any) =
        deps.forEach { this.implementation(it) }
    
    fun DependencyHandlerScope.testImplementations(vararg deps: Any) =
        deps.forEach { this.testImplementation(it) }
    in Gradle Kotlin DSL
    🆒 1
    🤩 1
    v
    t
    +2
    • 5
    • 8
  • r

    ritesh

    08/20/2025, 6:16 PM
    I started to see the error mentioned in 🧵 while trying to upgrade our project to Gradle-9. Warning turned error (https://docs.gradle.org/9.0.0/userguide/upgrading_version_8.html#deprecated_ambiguous_transformation_chains) in Gradle-9, when there are multiple artifact transformation chain to chose from for same requested attribute. Digging more - https://github.com/google/dagger/issues/4847 seems like it needs to be fixed from dagger end. I was wondering if at consumer end we can add a fix until it's fixed in upstream.
    v
    • 2
    • 8
  • a

    alexhelder

    08/21/2025, 1:02 AM
    What are people using to check if their dependencies are up to date? I was using ben-manes/gradle-versions-plugin but it stopped working with Gradle 9 / AGP 8.12.0
    c
    b
    v
    • 4
    • 11
  • t

    Teodora Mihaila

    08/21/2025, 12:14 PM
    Hi everyone! I'm working on adding OpenRewrite support for Kotlin 2.+. I am trying to build on top of the following PR. When trying to build the
    rewrite-kotlin
    module I get the following error:
    Copy code
    Caused by: java.lang.NoSuchMethodError: 'org.jetbrains.kotlin.buildtools.api.jvm.ClasspathEntrySnapshot org.jetbrains.kotlin.buildtools.api.CompilationService.calculateClasspathSnapshot(java.io.File, org.jetbrains.kotlin.buildtools.api.jvm.ClassSnapshotGranularity, boolean)'
    along with the following warning:
    Copy code
    w: ⚠️ 'org.jetbrains.kotlin:kotlin-compiler-embeddable' Artifact Present in Build Classpath
    The artifact `org.jetbrains.kotlin:kotlin-compiler-embeddable` is present in the build classpath along Kotlin Gradle plugin.
    This may lead to unpredictable and inconsistent behavior.
    I think it's important mentioning that I get when same error even when just trying to upgrade from Kotlin 1.9.25 to 2.2.0 in the main repo without the changes from the PR. From what I understand the cause of the error is a transitive dependency from the Kotlin Gradle plugin that introduces an older version on the build class path. So far I have tried to fix this by doing the following: 1. Exploring the config files for any hardcoded old Kotlin version, but nothing was found. 2. Commenting out the dependencies in the
    build.gradle.kts
    file of rewrite-kotlin
    module
    to prevent transitive leaks. Nothing changed. 3. Using the following command:
    ./gradlew :rewrite-kotlin:dependencies | grep -A 5 "kotlin-compiler-embeddable"
    to check which version of
    kotlin-compiler-embeddable
    was Gradle resolving. The versions all appeared to match the set Kotlin language version. 4. Disabled classpath snapshots into
    gradle.properties
    by adding:
    kotlin.incremental.useClasspathSnapshot=false
    . Nothing changed. 5. Testing multiple Gradle/JDK combinations: Gradle versions between 8.14.3 & 9.0.0 with JDK 17, 21, 23, 24. Nothing changed. Does anyone have any pointers on what could be going wrong and how to fix it?
    t
    m
    v
    • 4
    • 22
  • t

    tapchicoma

    08/21/2025, 3:38 PM
    gradle intensifies In the Kotlin team we've started looking into Kotlin DSL for Declarative Gradle. It is our chance to fix problems in existing KMP kts DSL without going through painful breaking changes. One of the challenges we have is how to design DSL for generic Kotlin library. Specifically configuration that applies to a family of Kotlin targets, not all targets. If you have some examples of shared configuration that you apply to subset of enabled targets in your existing library projects - please share them in the thread to this message. Also generic ideas on how Kotlin Library DCL DSL could look like are also welcome.
    ❤️ 9
    e
    h
    j
    • 4
    • 14
  • d

    David Herman

    08/22/2025, 7:13 AM
    I've got an old project that I'm trying to migrate over to use the new experimental jvm binaries DSL, and although I'm essentially writing code identical to the example at https://kotl.in/jvm-binaries-dsl it doesn't seem to pick up the main class I'm setting.
    t
    m
    v
    • 4
    • 9
  • f

    florent

    08/22/2025, 7:55 PM
    Morning! How do you migrate to that https://kotlinlang.org/docs/gradle-compiler-options.html#migrate-from-kotlinoptions-to-compileroptions in a convention plugin?
    t
    • 2
    • 6
  • c

    CLOVIS

    08/23/2025, 1:09 PM
    Copy code
    kotlin {
        js {
            compilerOptions {
                target.set("es2015")
            }
        }
    }
    How can I get which target is set from within a Gradle plugin? The only thing I see is
    project.kotlinExtension.sourceSets
    but that doesn't seem to have that option.
    m
    h
    +2
    • 5
    • 31
  • y

    Yongjun Hong

    08/26/2025, 12:26 PM
    🚀 [GSoC / Maven Central Utility Plugins for Gradle] Version 0.1.7 Released! 🚀 Hello everyone! I’d like to introduce a Gradle plugin I developed during the GSoC project. This plugin helps you manage Maven POM metadata more easily and efficiently, making artifact signing, POM validation, and hierarchical POM configuration much simpler. Main features: • Define a POM in the root project and manage it hierarchically • Artifact signature verification • POM validation • Automated checks for required fields In this release (v0.1.7), we’ve: • Fixed issues related to the
    license
    field • Redefined required fields • Completed the documentation You can check the updates and download the latest plugin here: • https://plugins.gradle.org/plugin/io.github.yonggoose.maven.central.utility.plugin.check • https://plugins.gradle.org/plugin/io.github.yonggoose.maven.central.utility.plugin.project • https://plugins.gradle.org/plugin/io.github.yonggoose.maven.central.utility.plugin.setting • Release notes: https://github.com/YongGoose/Maven-Central-utility-plugins-for-Gradle/releases/tag/v0.1.7 For usage instructions, you can refer to the docs directory for a simple guide: https://github.com/YongGoose/Maven-Central-utility-plugins-for-Gradle/tree/main/docs I’d really appreciate it if you could try it out and share your feedback! Special thanks to my mentor @Oleg Nenashev for continuous guidance and support throughout the project 🙏
    🙌 1