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

    CLOVIS

    05/16/2025, 5:13 PM
    During variant-aware dependency resolution, all Kotlin Native variants expose the attribute
    org.jetbrains.kotlin.platform.type = native
    , and are differentiated using the attribute
    org.jetbrains.kotlin.native.target = linux_x64
    (for example). I see that I can get the platform type using
    org.jetbrains.kotlin.gradle.plugin.KotlinTarget#getPlatformType
    , however I don't see how I can access the native target type (other than through parsing
    apiElementsConfigurationName
    etc).
    t
    • 2
    • 3
  • o

    Oleg Nenashev

    05/17/2025, 11:29 AM
    For Gradle folks going to Kotliconf, there is an opportunity to do the demos at the Kotlin Foundation Booth - kodee excited Kotlinconf Project demos are confirmed and announced! https://kotlinlang.slack.com/archives/C4J6927RR/p1747481062586769?thread_ts=1743148439.898769&cid=C4J6927RR
  • u

    ursus

    05/18/2025, 7:31 PM
    I want to surface kotlinc warnings, ideally as
    sarif
    so github PR ui will pick it up automatically. Is
    gradle problems api
    coming in 2.2 the way to do it?
    h
    v
    +2
    • 5
    • 8
  • m

    martmists

    05/21/2025, 10:14 AM
    How do I fix this gradle error?
    Copy code
    * What went wrong:
    A problem was found with the configuration of task ':site-frontend:webProductionExecutableCompileSync' (type 'DefaultIncrementalSyncTask').
      - Gradle detected a problem with the following location: '/home/mart/nintendo-posts/build/js/packages/nintendo-today-site-site-frontend-web/kotlin'.
        
        Reason: Task ':site-frontend:webBrowserDevelopmentWebpack' uses this output of task ':site-frontend:webProductionExecutableCompileSync' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
        
        Possible solutions:
          1. Declare task ':site-frontend:webProductionExecutableCompileSync' as an input of ':site-frontend:webBrowserDevelopmentWebpack'.
          2. Declare an explicit dependency on ':site-frontend:webProductionExecutableCompileSync' from ':site-frontend:webBrowserDevelopmentWebpack' using Task#dependsOn.
          3. Declare an explicit dependency on ':site-frontend:webProductionExecutableCompileSync' from ':site-frontend:webBrowserDevelopmentWebpack' using Task#mustRunAfter.
        
        For more information, please refer to <https://docs.gradle.org/8.11/userguide/validation_problems.html#implicit_dependency> in the Gradle documentation.
    From what I can tell I touch neither of these tasks in my build.gradle.kts, nor do I touch those generated files.
    m
    v
    • 3
    • 8
  • r

    rad

    05/24/2025, 9:12 AM
    I'm trying to use an internal declaration declared in one gradle subproject (
    :shared
    ) in another subproject (
    :orchestrator
    ). I've tried
    KotlinCompilation#associateWith
    but that errors because the target instances are not the same (Both are JVM though). So now I'm trying this to circumvent that check:
    Copy code
    val orchestratorMain = kotlin.target.compilations["main"]
    
    project(":shared").afterEvaluate {
      val associatedCompilations = (orchestratorMain.allAssociatedCompilations as MutableObservableSet<KotlinCompilation<*>>)
      val sharedMain = kotlin.target.compilations["main"]
    
      sharedMain.allAssociatedCompilations.forAll { compilation -> associatedCompilations.add(compilation) }
    }
    But this is still throwing compilation errors about the declaration being private
    v
    t
    • 3
    • 3
  • c

    Cagdas Caglak

    05/27/2025, 12:31 PM
    Hey, could you please share your best practices for
    android.packaging
    with me, especially for excluding duplicated files? Thank you.
    v
    • 2
    • 2
  • o

    Oleg Nenashev

    05/27/2025, 4:13 PM
    FYI Gradle 9.0.0-M9 is now published. It includes updates to Kotlin 2 and the K2 Compiler, as well as bumping to Java 17 as a minimum version, and most of the deprecation removals. Testers and any feedback are welcome! More about the upcoming Gradle 9 release: https://gradle.org/whats-new/gradle-9/
    👀 1
    🎉 10
    gradle intensifies 17
    s
    h
    t
    • 4
    • 10
  • a

    adjorno

    05/31/2025, 9:06 AM
    Hey! what’s the right way to build the final bundle for the Compose Web App? I see that
    Copy code
    ./gradlew jsBrowserProductionWebpack
    creates js files in the
    build/kotlin-webpack/productionExecutable
    but the index.html ends up in the
    build/processedResources
    folder so I have to collect them manually. Which feels weird. Any docs on how to create prod releases?
    c
    • 2
    • 1
  • m

    Mario Andhika

    06/02/2025, 4:03 AM
    What are the advantages of using libs.toml?
    👍 1
    ✅ 1
    g
    v
    • 3
    • 3
  • c

    CLOVIS

    06/03/2025, 10:09 AM
    How can I obtain a
    KotlinJsIrCompilation
    instance in a
    kotlin("multiplatform")
    project with
    js()
    enabled?
    s
    • 2
    • 3
  • o

    Oleg Nenashev

    06/04/2025, 9:49 AM
    📺 IntelliJ IDE Conference: In 10 minutes, join @eskatos and @Dmitriy Smirnov for the presentation about IntelliJ IDEA – The IDE That Speaks Gradle - https://www.youtube.com/live/qg6tj8Tf36E Why and when is a working CLI build not enough? What does it mean to actually support Gradle in an IDE? Why should you wait for that sync to finish? And what does paying that price bring? The Gradle and IntelliJ IDEA teams have long been collaborating to bring an optimal developer experience. In this talk, Gradle Principal Engineer Paul Merlin and IntelliJ IDEA Product Manager Dmitrii Smirnov will showcase the IDE’s capabilities for running, testing, navigating, and editing. They’ll also discuss technical implementations like what sync is and how it works, and shed light on what to expect in the future.
    🙌 1
  • a

    Anonymike

    06/04/2025, 7:50 PM
    Hi Everyone, I posted this in the wrong channel (before realizing there was a gradle channel) and @e5l tried to help out, but this is really disrupting my work at the moment. Our team upgraded all our core libraries and projects to kotlin 2.1.21 and everyone can build the projects fine except me. I haven't been able to identify the difference. I am able to build projects if I downgrade to 2.1.20. We use gradle wrapper and are on the same Gradle versions as well. I know this particular feature relates to a surprise deprecation by gradle. We're on Gradle 8.14.1 now, but have tried all the way back to 8.12.1. This is the error message that happens about 500ms after running the build command:
    Unable to find method ''org.gradle.internal.buildoption.BuildOption$Value org.gradle.api.internal.StartParameterInternal.getIsolatedProjects()''
    More info in thread... Any help is greatly appreciated! Right now to work on anything I have to downgrade every build involved to 2.1.20, do my work, avoid committing the changed version and rely on the rest of my team for final testing because I cannot run any 2.1.21 project.
    ✅ 1
    thank you color 1
    w
    t
    • 3
    • 11
  • j

    Justin Tullgren

    06/11/2025, 1:00 PM
    Hello, this is very gradle specific so I might ask in the gradle forums but does anyone know how I can depend on the kotlin-dsl plugin as an
    implementation
    dependency for a custom gradle plugin without applying the kotlin-dsl plugin to the custom gradle plugin build? I tried depending on this target but a lot of the kotlin extension functions weren’t found (same with others in the group).
    m
    e
    v
    • 4
    • 43
  • m

    mbonnin

    06/11/2025, 3:02 PM
    Copy code
    w: ⚠️ Usage of Internal Kotlin Gradle Plugin Properties Detected
    Can I suppress this ☝️
    t
    t
    • 3
    • 19
  • s

    svenjacobs

    06/16/2025, 11:48 AM
    Hello 👋🏼 What is the most pragmatical solution for getting some environment variable or Gradle command line parameter into compiled Kotlin code? I'm not talking about reading an environment variable during runtime. Let's say I want to have a
    const val VERSION = "1.0.0"
    in my code that can be specified during compile time. Of course I could use
    sed
    or something similar to dynamically edit a file before compilation but is there maybe a nicer way, something that the Kotlin Gradle plugin offers, maybe?
    d
    a
    +2
    • 5
    • 16
  • e

    eygraber

    06/17/2025, 9:14 PM
    Anyone else notice that publishing KMP artifacts to the new Maven Central Portal fails with a 404 for androidRelease
    👌 1
    h
    m
    s
    • 4
    • 7
  • m

    Mario Andhika

    06/19/2025, 2:18 AM
    I have this block in my build.gradle.kts. But my wasmJs source is not really ready yet, so I comment out this part of the code. How to save the configuration in a variable so that I can comment out just one line, instead of a block?
    Copy code
    wasmJs {
            outputModuleName = "composeApp"
            browser {
                val rootDirPath = project.rootDir.path
                val projectDirPath = project.projectDir.path
                commonWebpackConfig {
                    outputFileName = "composeApp.js"
                    devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply {
                        static = (static ?: mutableListOf()).apply {
                            // Serve sources to debug inside browser
                            add(rootDirPath)
                            add(projectDirPath)
                        }
                    }
                }
            }
            binaries.executable()
        }
    ✅ 1
    s
    • 2
    • 2
  • j

    Josh Friend

    06/19/2025, 12:36 PM
    Can I silence the "kotlin-compiler-embeddable Artifact Present in Build Classpath" somehow? I understand the problem it is raising and will address it, but I want to get rid of the thousands of logspam messages it throws during every build while I'm fixing it.
    ➕ 1
    a
    m
    • 3
    • 9
  • r

    reactormonk

    06/20/2025, 12:32 PM
    So I'm using a vendored gradle build:
    Copy code
    includeBuild("kable") {
        dependencySubstitution {
            substitute(module("com.juul.kable:kable-core")).using(project(":kable-core"))
        }
    }
    not kotlin but kotlin colored 1
    c
    v
    • 3
    • 4
  • o

    Oleg Nenashev

    06/23/2025, 8:38 AM
    📣 Gradle 9.0.0 RC1 is out and ready for testing! • 🔧 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.1 and #Groovy 4.0. It means new language features in the DSLs • ⚡ Improved Kotlin DSL build script compilation avoidance • 🧹 Clean up the deprecated APIs, • 🐛 Bug fixes and many minor improvements Full changelog: https://docs.gradle.org/9.0.0-rc-1/release-notes.html Please report any issue on GitHub - https://github.com/gradle/gradle/issues !
    gradle intensifies 6
    G 7
  • h

    hfhbd

    06/23/2025, 1:05 PM
    How can I create a MultiRelease jar (JPMS with Java 8 and Java 9 support) with the MPP plugin without calling
    jvm().withJava()
    because it is deprecated with error in Gradle 9.0.0? I need MPP due to expect/actual in JVM code.
    t
    • 2
    • 9
  • e

    eygraber

    06/23/2025, 6:22 PM
    I'm getting a deprecation in 2.2.0 on
    publishAllLibraryVariants
    with the deprecation message saying:
    Publishing all Android Variants implicitly is not recommended
    Calling
    publishAllLibraryVariants
    is not implicit, it is explicit, and I am explicitly saying I want all variants published. I don't want to have to specify each variant that I want published (especially when I have lots of flavors). Furthermore, the doc for
    publishLibraryVariants
    says:
    If set to null, which can also be done with publishAllLibraryVariants, all library variants will be published, but not test or application variants.
    t
    a
    • 3
    • 8
  • m

    martmists

    06/23/2025, 9:29 PM
    I'm having some issues with my setup where I have projects A depends on B depends on C, but because B gets loaded after A, it throws this error:
    Copy code
    org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'org.jetbrains.kotlin.jvm'.
       ...
    org.gradle.api.internal.DefaultMutationGuard$IllegalMutationException: Gradle#projectsEvaluated(Action) on build 'project_root_name' cannot be executed in the current context.
       ...
    The dependency is added as
    api(project(":B", "namedElements"))
    as required by the toolchain. How would I go about fixing it?
    t
    • 2
    • 3
  • e

    eygraber

    06/23/2025, 11:25 PM
    org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.KotlinProjectExtension.targets
    is deprecated, and says to replace it with
    org.jetbrains.kotlin.gradle.utils.KotlinProjectExtension.targets
    but that is
    internal
    t
    • 2
    • 1
  • p

    Piotr Krzemiński

    06/26/2025, 9:03 PM
    when updating Kotlin to 2.2.0, I'm getting this when building `buildSrc`:
    Copy code
    e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/2.2.0/4258f471b10f4fce1b1c000b59495b7413e1af9a/kotlin-reflect-2.2.0.jar!/META-INF/descriptors.jvm.kotlin_module Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.2.0, expected version is 2.0.0.
    Do I think correctly that we need to wait for Gradle supporting metadata of at least 2.1.0?
    t
    v
    • 3
    • 5
  • h

    Hugo Costa

    07/01/2025, 1:24 PM
    Hello, I have a nitpick I want to share with you, you recently launched a new gradle plugin that doesn't meet the previous naming convention - https://mvnrepository.com/artifact/org.jetbrains.kotlin/fus-statistics-gradle-plugin (all other language libraries are kotlin-*). I doubt you'll change it, but just fyi so in the future you keep it, makes it clear which package is related to the core language requirements
  • j

    jrod

    07/01/2025, 9:06 PM
    are there any known plugins/tools that will automatically migrate a module to
    explicitApi()
    when enabled?
    v
    t
    • 3
    • 2
  • r

    rnett

    07/02/2025, 12:03 AM
    I'm attempting to add some configuration to all Kotlin source sets based on my Plugin's extension (to add a dependency, or not based on the extension property). This seems pretty straightforward, just use
    KotlinBaseExtension.sourceSets.configureEach { ... }
    . However, the source sets appear to be configured/resolved before the build script is ran, meaning setting properties in my extension isn't reflected in the configuration since the added configuration runs first. Is this known or expected behaviour? I can probably slap an
    afterEvaluate
    on it but I'd prefer to avoid that if possible since it's a whole can of worms.
    v
    • 2
    • 3
  • k

    Kelvin Chung

    07/02/2025, 6:17 AM
    Does anyone have an example of using the Kotlin Multiplatform plugin (with a JVM target) with the JVM Test Suite and Test Report Aggregation plugins? It seems like the aggregation plugin isn't able to pick up the test report from
    allTests
    or
    jvmTests
    at all.
    v
    • 2
    • 1
  • a

    andrew

    07/02/2025, 4:30 PM
    I'm trying to get koog working with gradle as a plugin (we are trying to write a plugin to perform some AI related tasks for our CI + local builds). However it uses the new experimental
    kotlin.uuid.Uuid
    API and Gradle cannot find the class. Is there a good way to ensure my gradle daemon uses the right version of Kotlin under the hood + opt into the experimental API?
    m
    e
    • 3
    • 5