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

    Colton Idle

    06/18/2025, 1:28 PM
    I've got an intermittent issue that's been hitting an android app while on CI, not locally (new employee!). There's only two of us, and the person that did the initial build setup is long gone. The intermittent issue is > The message received from the daemon indicates that the daemon has disappeared After researching it seems like it could be because of
    org.gradle.jvmargs
    . The project isn't really that big, but it does use buildSrc (😒), some code-gen + ksp and a bunch of modules. I think this app could probably just be one single module because the app really isn't that involved (but I can't change that now) jvmargs is set to
    -Xmx12g -Xms4g -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=2g -XX+HeapDumpOnOutOfMemoryError
    The rest of the gradle.properties is pretty basic
    android.useAndroidX=true
    kotlin.code.style=official
    kotlin.daemon.jvmargs-Xmx4g
    Doesn't fail locally on my 16GB machine (but it is slow as heck), but fails on CI on a 16GB machine.
    a
    v
    • 3
    • 12
  • e

    Eli Graber

    06/18/2025, 10:43 PM
    Is there a project isolation compatible way to specify that all subprojects should have a specific plugin applied? My use case is that I have a convention plugin that I want applied to all subprojects, but I don't want to have to remember to add it for any new subproject.
    v
    c
    m
    • 4
    • 10
  • r

    Robert Elliot

    06/19/2025, 1:07 PM
    Putting this here to be shot at... I have tasks that generate sources in a multi-project build. Interested in thoughts on this structure: (code in 🧡)
    v
    • 2
    • 7
  • b

    Brais GabΓ­n Moreira

    06/20/2025, 12:47 PM
    Hi, does someone know how can I set a gradle property using the ProjectBuilder API? I have a grade plugin and I want to test what happend when I have ksp2 active or not using
    ksp.useKSP2
    . (Yes, I'm also testing against an old version of ksp because reasons)
    a
    • 2
    • 5
  • c

    Callum Rogers

    06/20/2025, 1:01 PM
    anyone know how to diagnose β€œdowngrades” in dependency resolution? I have this dep that’s being
    Forced
    down from 2.38.0 to 2.36.0 (as per a build scan) and I don’t know why. Is there a way to see more info about why it is forced? I can’t see any usages of
    resolutionStrategy.force
    in any of the buildscripts or plugins at least.
    • 1
    • 2
  • s

    Sebastian Schuberth

    06/20/2025, 1:57 PM
    I'm getting a bit frustrated with getting the publication of a version-catalog for my multi-module project working. My multi-project is already published to Maven Central, and I just want to additionally publish a version catalog for easier consumption by users. At first I though each project can just "opt-in" to be part of the version-catalog, but after reading the docs it seems that I need to create a new subproject that is exclusively responsible for publishing the version-catalog. In that new project, I need to manually list all libraries via a DSL. So the 1M-question is: How can I add all libraries of my multi-project there without hard-coding everything? If I iterate over subprojects, I fear that I'm again violating some Gradle best-practices about decoupling projects 😬
    t
    v
    t
    • 4
    • 16
  • 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