https://gradle.com/ logo
Join Slack
Powered by
# community-support
  • j

    Javi

    06/23/2025, 12:09 PM
    I know this is not a Gradle issue but Windows and macOS are not smart enough to just not giving Gradle all the CPU and blocking the rest of tools of being usable... Running
    ./gradlew build
    in the terminal and getting IDEA/AS totally frozen during seconds or minutes is really annoying. Is there a workaround to just limit Gradle to use 90% CPU usage or something similar?
    j
    a
    m
    • 4
    • 4
  • j

    Jendrik Johannes

    06/23/2025, 12:09 PM
    Hey community. What's the best plugin(s) that print the task graph for a given Gradle invocation? I am thinking of something like
    dependencies --configuration=someClasspath
    but for task dependencies. Should ideally print to the console. I know that there are several plugins out there – some of them unmaintained. Has anyone researched this recently or successfully uses an existing plugin?
    s
    v
    +3
    • 6
    • 8
  • v

    Vladimir Sitnikov

    06/23/2025, 12:25 PM
    I wonder if there’s a public API to get
    BuildOperationListener
    notification on the build completion along with success/failure results. I see people use
    org.gradle.internal.build.event.BuildEventListenerRegistryInternal.onOperationCompletion
    (see https://github.com/gradle/gradle/blob/836ece17243a8366c749394e1cef4c4bafd0d7fa/tes[…]adle/integtests/fixtures/executer/ProgressLoggingFixture.groovy ) BuildOperationNotificationListenerRegistrar seems to be internal as well, and it seems to conflict with build scan plugin: https://github.com/gradle/gradle/issues/19552
  • m

    Martin

    06/23/2025, 2:57 PM
    Using the new PI-isolation
    project.gradle.lifecycle.beforeProject {}
    is there a way to do the usual trick of aggregating all projects into the root project? I can add a plugin to every project. But how do I collect the list of all projects to add as dependencies to the root project?
    a
    j
    +2
    • 5
    • 22
  • c

    Colton Idle

    06/23/2025, 6:43 PM
    My CI has a "release" job that is basically 1.
    ./gradlew testXYZ
    2.
    ./gradlew assembleXYZ
    Is there a better way to run those two commands so that I can make sure if
    testXYZ
    compiles my code, the
    assembleXYZ
    task can re-use that compilation? Or is that just by nature how gradle work and so no changes needed from my end?
    t
    • 2
    • 1
  • m

    Martmists

    06/23/2025, 10:19 PM
    I'm having some issues with my setup where I have projects A depends on B, 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?
    v
    • 2
    • 1
  • p

    Philip W

    06/24/2025, 10:52 AM
    Why does the
    mavenCentral()
    shortcut do not include
    mavenContent { releasesOnly() }
    ? The central portal only supports releases enforced by sonatype.
    👍 4
    v
    j
    v
    • 4
    • 6
  • m

    Martin

    06/25/2025, 2:29 PM
    I'm creating a custom
    MavenPublication
    . I can add artifacts to that publication that are created lazily by other tasks. Can I do the same for the
    .pom
    file? Have a task that generates the pom file?
    v
    • 2
    • 30
  • i

    Ivan CLOVIS Canet

    06/26/2025, 7:10 AM
    I have a task with an input that is a
    RegularFileProperty
    which is generated by another task (in a plugin I don't control) but isn't an output. Without configuration cache, everything works well. With configuration cache, Gradle tries to configure the input before running any tasks, and that breaks because it's not possible to know what the file will be. Is there a way to set a
    Property
    with a flag that it must be lazily-generated?
    m
    v
    a
    • 4
    • 88
  • m

    Matthew Von-Maszewski

    06/26/2025, 2:59 PM
    has anyone already solved the problem of gradle 8's zip file being too large to check-in to github? My goal is to eliminate downloading the file from gradle during every CircleCI execution (and Jenkins execution):
    Copy code
    remote: error: See <https://gh.io/lfs> for more information.
    remote: error: File gradle/wrapper/gradle-8.11-bin.zip is 130.57 MB; this exceeds GitHub's file size limit of 100.00 MB
    remote: error: GH001: Large files detected. You may want to try Git Large File Storage - <https://git-lfs.github.com>.
    t
    • 2
    • 3
  • r

    René

    06/26/2025, 3:38 PM
    has anyone ever seen this when trying to sign a maven publication :
    Copy code
    Exception is:
    org.gradle.internal.execution.WorkValidationException: Some problems were found with the configuration of task ':elasticsearch-spark-30:signSpark30scala213Publication' (type 'Sign').
      - In plugin 'org.gradle.plugins.signing.SigningPlugin_Decorated' type 'org.gradle.plugins.signing.Sign' property 'generatorsByKey./Users/rene/dev/elastic/elasticsearch-hadoop/spark/sql-30/build/classes/scala/spark30scala213.toSign' file '/Users/rene/dev/elastic/elasticsearch-hadoop/spark/sql-30/build/classes/scala/spark30scala213' is not a file.
    
        Reason: Expected an input to be a file but it was a directory.
    
        Possible solutions:
          1. Use a file as an input.
          2. Declare the input as a directory instead.
    
        For more information, please refer to <https://docs.gradle.org/8.14.2/userguide/validation_problems.html#unexpected_input_file_type> in the Gradle documentation.
      - In plugin 'org.gradle.plugins.signing.SigningPlugin_Decorated' type 'org.gradle.plugins.signing.Sign' property 'generatorsByKey./Users/rene/dev/elastic/elasticsearch-hadoop/spark/sql-30/build/resources/spark30scala213.toSign' file '/Users/rene/dev/elastic/elasticsearch-hadoop/spark/sql-30/build/resources/spark30scala213' is not a file.
    🙅‍♂️ 1
    v
    • 2
    • 11
  • d

    Dinesh Kannan Rajaram

    06/27/2025, 9:48 AM
    Hey 👋 Need some help figuring out an issue. I get this error when configuring a composite build. This works locally and in one of my CI. In another CI (github) I see this error. Any pointers is much appreciated.
    Copy code
    4 actionable tasks: 4 executed
    FAILURE: Build failed with an exception.
    * What went wrong:
    Project ':project:sub-project:another-sub-project' should be in state Created or later.
    v
    t
    • 3
    • 10
  • m

    Matthew Von-Maszewski

    06/27/2025, 5:22 PM
    One of my coworkers has enabled parallel tasks in his gradle config via
    org.gradle.parallel=true.
    This is fine for his normal workflow of "./gradlew dist" (dist is our custom task). But if he wants to "./gradlew clean dist", the two tasks now run simultaneously. How do I setup a dependency such that "dist" must follow "clean" if and only if "clean" requested?
    e
    v
    • 3
    • 6
  • g

    GOURAB Swain dev

    06/27/2025, 5:50 PM
    just starting to learn coding but after choosing gradle this error is showing whats the problem here ? coding in kotlin on intellijidea
    v
    • 2
    • 2
  • a

    Alex Beggs

    06/28/2025, 1:28 PM
    I am working on a repo that has a Composite Build: Project A -> Composite Build "Shared" • B • C (uses properties to configure) I know you can call Gradle on the command line using
    ./gradlew -Pproperty1=helloworld :a:assemble
    and
    C
    will get configured with the
    property1
    value being passed into the configuration. We use a
    version
    file that contains some information that is used by
    C
    but could be different based on the calling outer project
    A
    or some other project. What would be the best practice to be able to read the
    version
    file and pass it down to project
    C
    ? Ideally I would be able to set the properties from the outer project
    A
    before the configuration gets called for
    C
    but that doesn't seem to be possible since
    A
    happens after
    C
    Is there something that can be done in the settings.gradle.kts? I know this can be done via the root projects
    gradle.properties
    or the command line
    -P
    option, but it is unclear to me how it can be done outside of those options. Is there a way to load a set of properties in the root project and pass those properties into the composite build?
    e
    • 2
    • 4
  • m

    Mike Wacker

    06/29/2025, 3:43 AM
    For the purpose of deciding what's
    api
    vs.
    implementation
    , if a Java annotation is applied to a public class or method, is that annotation part of the ABI (application binary interface)? And does the answer depend on the retention policy of the annotation (
    SOURCE
    vs.
    CLASS
    vs.
    RUNTIME
    )? A practical example would be a public "value type" that's annotated with
    @Value.Immutable
    ,
    @JsonSerialize
    , and
    @JsonDeserialize
    . Are Immutables and Jackson
    api
    or
    implementation
    deps in that scenario?
    t
    v
    • 3
    • 12
  • m

    Martin

    06/29/2025, 11:47 AM
    Is it ok to use cross-project artifact sharing (with outgoingVariants, etc...) but inside a single project? I have always tried to avoid it for some reason but feels like this should just work?
    p
    v
    • 3
    • 2
  • i

    Ivan CLOVIS Canet

    06/29/2025, 6:55 PM
    How can I configure a single dependency into multiple configurations in a single line? Currently, I have:
    Copy code
    dependencies {
        dokka(projects.a)
        dokka(projects.b)
        kover(projects.a)
        kover(projects.b)
        nmcpAggregation(projects.a)
        nmcpAggregation(projects.b)
        // …
    }
    which is not fun to maintain when there are dozens of projects. Instead, I'd rather have:
    Copy code
    dependencies {
        library(projects.a)
        library(projects.b)
    }
    where
    library
    is a custom configuration that applies its contents to
    dokka
    ,
    kover
    and
    nmcpAggregation
    . I've tried:
    Copy code
    val library by configurations.registering {
    	isCanBeResolved = false
    	isCanBeConsumed = false
    }
    
    configurations.dokka.get().extendsFrom(library.get())
    configurations.kover.get().extendsFrom(library.get())
    configurations.nmcpAggregation.get().extendsFrom(library.get())
    but that only seems to partially work. I'm testing it in a build that looks like
    Copy code
    Root project 'Kotlin-example'
    +--- Project ':app'
    +--- Project ':core'
    +--- Project ':mkdocs'
    \--- Project ':plugin'
    where the root project contains
    Copy code
    dependencies {
        library(projects.core)
    }
    The NMCP plugin seems to pick up the dependency:
    Copy code
    $ … dependencies --configuration nmcpAggregation
    nmcpAggregation
    \--- project :core FAILED
    However, the Kover configuration gets the current project for some reason:
    Copy code
    $ … dependencies --configuration kover 
    kover (n)
    \--- project Kotlin-example (n)
    And the Dokka plugin doesn't get anything at all:
    Copy code
    $ … dependencies --configuration dokka
    dokka - Fetch all Dokka files from all configurations in other subprojects. (n)
    No dependencies
    What's going on? If
    extendsFrom
    isn't the correct way to do this, what is?
    p
    m
    +2
    • 5
    • 10
  • r

    Roldan Galan

    06/30/2025, 1:41 PM
    Hello! 👋 In my project we have a few included builds and I just noticed this warning in a Develocity scan:
    The build cache configuration of the root build differs from the build cache configuration of the early evaluated ':projectA', ':projectB' included builds. It is recommended to keep them consistent, see here.
    That documentations says:
    Such included builds will inherit the build cache configuration from the top level build, regardless of whether the included builds define build cache configuration themselves or not. The build cache configuration present for any included build is effectively ignored, in favour of the top level build’s configuration.
    I have no specific build cache configuration on such included build modules, so I am actually expecting to inherit the build cache config from my root build. If the build cache configuration on the included builds is going to be ignored and inherit whatever is in the root build... what is the purpose of such warning? 🤔 I would understand it if I had some specific build cache config that conflicts with the root. But does it make sense to flag this when there is nothing defined in the included builds? Thanks!
    v
    • 2
    • 5
  • a

    Amit Kumar Chauhan CB Ara

    06/30/2025, 2:06 PM
    Hi, I need help in this error {Launching lib\main.dart on sdk gphone64 x86 64 in debug mode... FAILURE: Build failed with an exception. * Where: Build file 'D:\flutterproject\recipeappdev\android\build.gradle.kts' line: 1 * What went wrong: Error resolving plugin [id: 'org.jetbrains.kotlin.android', version: '2.1.0', apply: false]
    The request for this plugin could not be satisfied because the plugin is already on the classpath with a different version (1.8.22).
    * Try:
    Run with --stacktrace option to get the stack trace.
    Run with --info or --debug option to get more log output.
    Run with --scan to get full insights.
    Get more help at https://help.gradle.org.
    BUILD FAILED in 15s Running Gradle task 'assembleDebug'... 15.9s Error: Gradle task assembleDebug failed with exit code 1}
    v
    • 2
    • 1
  • c

    Colton Idle

    06/30/2025, 6:57 PM
    My team has
    org.gradle.jvmargs= -Xmx12g -Xms4g
    set in our android project in the gradle.properties for the repo. Can I override that easily without having to commit those changes to my entire team? I'd love to bump the 12g down to 6g. Everything I'm reading basically says that the project ones will take pretty much the highest priority, but that seems weird as if theres no way to update it to my personal prefs without affecting the whole team
    t
    m
    +2
    • 5
    • 13
  • k

    Kelvin Chung

    07/01/2025, 7:06 AM
    Hey folks. I'm trying to get the
    jacoco
    plugin to work with a Kotlin Multiplatform project that has a jvm target. A few questions: 1. When setting up my own convention plugin, is there a way to not apply the
    jacoco
    plugin if a KMP project does not have a JVM target? 2. Do we need to explicitly make
    jacocoTestReport
    explicitly depend on
    jvmTest
    , like we do with
    test
    in a Kotlin JVM project? Any help would be appreciated.
  • j

    Jendrik Johannes

    07/01/2025, 11:41 AM
    Hey I have a simple question (famous last words...). I think it is also one of these riddles that could be in a Gradle quiz. And I am hoping this is documented somewhere and I just didn't find it. How do I exclude empty directories from a
    FileTree
    ?
    Input is:
    Copy code
    src
    └── a
        ├── b
        │   └── c
        │       └── x.tmp
        └── z.txt
    Some task using
    matching
    :
    Copy code
    val src = layout.projectDirectory.dir("src").asFileTree.matching {
        include("**/*.txt")
    }
    tasks.register<Sync>("sync") {
        from(src)
        into(layout.buildDirectory.dir("target"))
    }
    Then I get (I find it surprising that
    **/*.txt
    matches the directories 🤷‍♀️ )
    Copy code
    build/target
    └── a
        ├── b
        │   └── c
        └── z.txt
    How do I get?
    Copy code
    build/target
    └── a
        └── z.txt
    (Wrong solutions in Thread)
    👀 1
    v
    t
    +2
    • 5
    • 59
  • k

    Kelvin Chung

    07/02/2025, 4:36 AM
    Question: How do you use the test report aggregation plugin with the Kotlin multiplatform plugin? In my aggregation project, I have
    Copy code
    dependencies {
      testReportAggregation("...") // coordinates of the KMP included build
    }
    which is normal, but I get an error saying
    Copy code
    > Could not resolve all dependencies for configuration ':aggregation:testing:aggregateTestReportResults'.
       > The consumer was configured to find a component of category 'verification', as well as attribute 'org.gradle.testsuite.name' with value 'test', attribute 'org.gradle.verificationtype' with value 'test-results'.
    Which is weird, since I get test reports from my KMP included build by running
    allTests
    and
    jvmTests
    , as expected.
    v
    • 2
    • 1
  • m

    Martin

    07/02/2025, 12:12 PM
    Is there a public API that allows a plugin to read and write entries in the build cache?
    v
    v
    t
    • 4
    • 15
  • m

    Max Douglas

    07/02/2025, 6:17 PM
    I got a message from the Google Play store telling me I needed to update my target API to 35. This seemed like a simple request. I tried updating all instances of 34 to 35, which did not work. I tried researching the issue, which lead to updating my APG, which lead to upgrading Android Studio to 2025.1.1 After updating AS my app's gradle version is too outdated for AS to run. I tried using APG to update to 9.0-milestone-1 and got the following error Could someone help me fix this?
    p
    v
    • 3
    • 24
  • b

    Ben Berman

    07/02/2025, 7:40 PM
    Why can't gradle correctly exit processes that it starts in
    Exec
    when the task receives
    Ctrl+C
    , but everything else can? I have found around 220 reports of issues related to this, since at least 2013 What am I not understanding?
    j
    • 2
    • 19
  • i

    Ian Ager

    07/02/2025, 8:41 PM
    I’ve finally managed to strip out all my transitive
    api platform("com.fasterxml.jackson:jackson-bom:2.18.0")
    dependencies across all my libraries and to my surprise that’s made the warnings go away. Still curious if anybody knows what the problem actually was here though? Is declaring a BOM as an
    api
    dependency such a bad offence that it’s expected gradle would behave unpredictably?
    v
    • 2
    • 2
  • c

    Clayton Walker

    07/02/2025, 10:01 PM
    Are there more docs related to https://docs.gradle.org/current/userguide/gradle_daemon.html#continuous_integration available? There appears to be no examples, recommendations, best practices etc. How many builds before we should consider retiring a build box? Should we git clean before git fetch? Should it run on bare metal, a vm, or a container? Should the box have swap? AWS EBS, or attached NMVe? Should we still use the remote build cache node, or is local cache strictly superior?
    v
    • 2
    • 7
  • k

    Kelvin Chung

    07/03/2025, 1:31 AM
    Question: I'm trying to integrate the Kotlin multiplatform plugin as part of a precompiled script, like so:
    Copy code
    plugins {
      kotlin("multiplatform")
    }
    
    kotlin {
      jvm()
    }
    
    tasks.register("doSomething") {
      dependsOn(tasks.jvmTest)
    }
    That last part doesn't compile, probably because there is no accessor for
    jvmTest
    even though by all rights it should exist. Of course, changing it to
    tasks.named("jvmTest")
    works, but what would cause the accessors to not be useable? (Compare this to, say,
    commonMain
    , which is useable)
    e
    • 2
    • 4