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

    Colton Idle

    10/23/2025, 9:43 PM
    Is there a gradle code search (similar to cs.android.com) ? For example... I'm just trying to find what mavenCentral() and google() actually resolve to in gradle but github search is atrocious.
    e
    v
    • 3
    • 16
  • v

    Vlastimil Brecka

    10/24/2025, 12:12 AM
    Copy code
    subprojects {
        tasks.register("foo") { … }
    }
    ELI5 why does this break configuration avoidance? It's using
    register
    which makes task instantiation lazy.. so what's the problem? Docs basically just say its bad because it injects code not visible at project build file (sure), and it introduces comfiguration time coupling (not sure what does it mean) How exactly am I tanking perf by this?
    c
    v
    • 3
    • 5
  • s

    Slackbot

    10/24/2025, 2:10 PM
    This message was deleted.
    v
    f
    • 3
    • 7
  • b

    Ben Bader

    10/24/2025, 3:52 PM
    👋 While doing a code-review for someone's gradle plugin, I just encountered something I hadn't seem before, and want to know whether there's any basis for my suspicion. Basically, the are registering an extension for their plugin, but instead of using it for configuration, they are using it to expose properties that they then wire up as inputs to other tasks. For example:
    Copy code
    def myExtensionOutput = extensions.getByName("myExtension").outputFilePath
    
    tasks.register("someTask") {
      inputs.file(myExtensionOutput)
    }
    The reason they do this is because the file at the output path is expected to just be there as a result of a previous task execution. There is no implied dependency on the source task in the graph. My question is, is this wrong? Why? It feels wrong to me but I can't think of any actual problem they'd encounter and I'd like to check my assumptions. (clearly the better solution is to pass the path in as a property/env-var/well-known-file, and that's what I've recommended)
    m
    y
    +2
    • 5
    • 16
  • c

    Colton Idle

    10/24/2025, 7:14 PM
    android-ish question, but every dependency defined with
    implementation
    is automatically also available in
    androidTestImplementation
    right? Same goes for unit tests. So you don't have to redefine every dep to be implementation and testImplementation right?
    t
    e
    • 3
    • 6
  • v

    Vlastimil Brecka

    10/24/2025, 7:43 PM
    Is there a way to somehow have groups of projects, and then select which one is active? We currently have a big build with 400 modules (multiple apps). Local dev machines are managing just fine, so I'd like keep is this way - and having ability to build everything in one command is a superpower which I obviously want to keep. But not every team needs such bird's eye view of the whole build, mostly they're working on their part of the codebase. And some voiced that it would be nice if they only saw their part & it's dependency modules, to scope down the complexity Obvioulsy I know I can "hack" it via commenting out the projects in
    settings.gradle
    But isn't there something more sophisticated? Other than flipping it on its head, having per app builds & then one composite one (which I would not prefer)
    👀 1
    v
    a
    • 3
    • 6
  • c

    Colton Idle

    10/26/2025, 5:31 AM
    any resources on how to best use setup-gradle github action? a teammate setup our gradle action and it's realllllly not good. two examples, they're extracting the version number of gradle from our project, instead of just relying on the gradle wrapper... and theyre also pulling in some
    cache
    github action and trying to cache certain downloads from gradle there. i have 0 experience setting up github actions with a gradle+android project (i usually use bitrise) so im unsure if this sort of caching thing is just handled for free when using the official gradle step. thanks!
    e
    p
    +2
    • 5
    • 16
  • r

    Robert Elliot

    10/26/2025, 11:48 AM
    Hi - I need to upgrade from
    com.github.johnrengelman.shadow:8.1.1
    to
    com.gradleup.shadow:9.2.2
    , and it breaks some of my existing gradle config. Details in thread.
    v
    • 2
    • 12
  • c

    Colton Idle

    10/26/2025, 7:57 PM
    Related to my last question. Does anyone know how to run github actions locally with the setup-gradle action? I've been looking at using nektos/act which seems popular as a local github action runner, but it doesn't support setup-gradle v4 or v5 (it does seem to work fine with v3 tho). Just wanna see if theres something the gradle community uses already
    e
    • 2
    • 3
  • p

    Philipp Nowak

    10/27/2025, 7:34 AM
    I try to upgrade our Android project to Gradle 9.1 and came across this issue: https://github.com/gradle/gradle/issues/33619 - all unit tests fail. The suggested workarounds, i.e.
    isIncludeAndroidResources = false
    and
    failOnNoDiscoveredTests = false
    do not seem to work, I still get the same error
    Copy code
    There are test sources present and no filters are applied, but the test task did not discover any tests to execute. This is likely due to a misconfiguration. Please check your test configuration. If this is not a misconfiguration, this error can be disabled by setting the 'failOnNoDiscoveredTests' property to false.
    Upgrading AGP to an alpha 9.x is no option for us atm. Did anyone solve this problem?
    ✅ 1
    v
    • 2
    • 6
  • r

    Rahul Srivastava

    10/27/2025, 7:57 AM
    hello team i am trying to build thingsboard iot oppen source code but getting error related to gradle
    Copy code
    [ERROR] Failed to execute goal org.thingsboard:gradle-maven-plugin:1.0.12:invoke (default) on project edqs: org.gradle.tooling.BuildException: Could not execute build using connection to Gradle distribution '<https://services.gradle.org/distributions/gradle-7.3.3-bin.zip>'. -> [Help 1]
    while looking deeper in the issue i got that it is not able to build the gradle.build file my gradle.buuld file looks like this
    Copy code
    /**
     * Copyright © 2016-2025 The Thingsboard Authors
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     <http://www.apache.org/licenses/LICENSE-2.0>
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    import org.apache.tools.ant.filters.ReplaceTokens
    
    plugins {
        id "nebula.ospackage" version "8.6.3"
    }
    
    buildDir = projectBuildDir
    version = projectVersion
    distsDirName = "./"
    
    // OS Package plugin configuration
    ospackage {
        packageName = pkgName
        version = "${project.version}"
        release = 1
        os = LINUX
        type = BINARY
    
        into pkgInstallFolder
    
        user pkgUser
        permissionGroup pkgUser
    
        // Copy the actual .jar file
        from(mainJar) {
            // Strip the version from the jar filename
            rename { String fileName ->
                "${pkgName}.jar"
            }
            fileMode 0500
            into "bin"
        }
    
        if("${pkgCopyInstallScripts}".equalsIgnoreCase("true")) {
            // Copy the install files
            from("${buildDir}/bin/install/install.sh") {
                fileMode 0775
                into "bin/install"
            }
    
            from("${buildDir}/bin/install/upgrade.sh") {
                fileMode 0775
                into "bin/install"
            }
    
            from("${buildDir}/bin/install/logback.xml") {
                into "bin/install"
            }
        }
    
        // Copy the config files
        from("${buildDir}/conf") {
            exclude "${pkgName}.conf"
            fileType CONFIG | NOREPLACE
            fileMode 0754
            into "conf"
        }
    
        // Copy the data files
        from("${buildDir}/data") {
            fileType CONFIG | NOREPLACE
            fileMode 0754
            into "data"
        }
    
        // Copy the extensions files
        from("${buildDir}/extensions") {
            into "extensions"
        }
    }
    
    // Configure our RPM build task
    buildRpm {
    
        arch = NOARCH
    
        archiveVersion = projectVersion.replace('-', '')
        archiveFileName = "${pkgName}.rpm"
    
        requires("(java-17 or java-17-headless or jre-17 or jre-17-headless)") // .or() notation does work in RPM plugin
    
        from("${buildDir}/conf") {
            include "${pkgName}.conf"
            filter(ReplaceTokens, tokens: ['pkg.platform': 'rpm'])
            fileType CONFIG | NOREPLACE
            fileMode 0754
            into "${pkgInstallFolder}/conf"
        }
    
        preInstall file("${buildDir}/control/rpm/preinst")
        postInstall file("${buildDir}/control/rpm/postinst")
        preUninstall file("${buildDir}/control/rpm/prerm")
        postUninstall file("${buildDir}/control/rpm/postrm")
    
        user pkgUser
        permissionGroup pkgUser
    
        // Copy the system unit files
        from("${buildDir}/control/template.service") {
            addParentDirs = false
            fileMode 0644
            into "/usr/lib/systemd/system"
            rename { String filename ->
                "${pkgName}.service"
            }
        }
    
        link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")
        link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
    }
    
    // Same as the buildRpm task
    buildDeb {
    
        arch = "all"
    
        archiveFileName = "${pkgName}.deb"
    
        requires("openjdk-17-jre").or("java17-runtime").or("oracle-java17-installer").or("openjdk-17-jre-headless")
    
        from("${buildDir}/conf") {
            include "${pkgName}.conf"
            filter(ReplaceTokens, tokens: ['pkg.platform': 'deb'])
            fileType CONFIG | NOREPLACE
            fileMode 0754
            into "${pkgInstallFolder}/conf"
        }
    
        configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf")
        configurationFile("${pkgInstallFolder}/conf/${pkgName}.yml")
        configurationFile("${pkgInstallFolder}/conf/logback.xml")
        configurationFile("${pkgInstallFolder}/conf/actor-system.conf")
    
        preInstall file("${buildDir}/control/deb/preinst")
        postInstall file("${buildDir}/control/deb/postinst")
        preUninstall file("${buildDir}/control/deb/prerm")
        postUninstall file("${buildDir}/control/deb/postrm")
    
        user pkgUser
        permissionGroup pkgUser
    
        // Copy the system unit files
        from("${buildDir}/control/template.service") {
            addParentDirs = false
            fileMode 0644
            into "/lib/systemd/system"
            rename { String filename ->
                "${pkgName}.service"
            }
        }
    
        link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")
        link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
    }
  • r

    Rahul Srivastava

    10/27/2025, 7:58 AM
    i am using mac jdk 17.0.17
    🧵 1
    v
    • 2
    • 1
  • p

    Philip W

    10/27/2025, 12:51 PM
    Is there any builtin-easy way to call a TransformAction directly? I want to download a yaml file from a url and I need to transform it into a json file. Of course I could setup a fake repo, add all the attributes, but it there any simple way to call a TransformationAction with an already downloaded file? Or do I really need to use a custom task?
    v
    • 2
    • 1
  • a

    Andy Damevin

    10/28/2025, 9:02 AM
    Hello, I have been trying to allow running Deno (Light node)/Esbuild and other native binaries as a Maven/Gradle Java library. Allowing arch specific dependencies already works fine in Maven and in NPM ecosystems and I thought it would also work on Gradle as documented (doc about variants). But it didn't work at all, when debugging I can see it's using the module file but it's not checking the arch native stuff at all. I must be missing something. I found a few related issue (such as https://github.com/gradle/gradle/issues/34845), but didn't find a solution to my issue yet.
    v
    • 2
    • 42
  • a

    Albert ten Napel

    10/28/2025, 2:12 PM
    Hello, I have a "compile" task that contains the following code:
    Copy code
    source = fileTree("$projectDir").matching {
        include("$javaSourceDirName/**/*.java")
        excludedJavaFiles.forEach { exclude(it) }
    }
    This results in many errors such as:
    Copy code
    Cannot infer source root(s) for source `file 'C:\...\Blabla.java'`. Supported types are `File` (directories only), `DirectoryTree` and `SourceDirectorySet`.
    This seems to disable incremental compilation. How can I fix this code snippet?
    ✅ 1
    v
    • 2
    • 7
  • z

    Zeynep Ozdemir

    10/28/2025, 10:25 PM
    Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows PS C:\cprg303\cprg303LabAssignments> npx react-native run-android info A dev server is already running for this project on port 8081. info Installing the app... [Incubating] Problems report is available at: file///C/cprg303/cprg303LabAssignments/android/build/reports/problems/problems-report.html Deprecated Gradle features were used in this build, making it incompatible with Gradle 10. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/9.0.0/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. 10 actionable tasks: 10 up-to-date info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor FAILURE: Build failed with an exception. * Where: Build file 'C:\cprg303\cprg303LabAssignments\android\build.gradle' line: 21 * What went wrong: A problem occurred evaluating root project 'cprg303LabAssignments'.
    Failed to apply plugin 'com.facebook.react.rootproject'.
    > A problem occurred configuring project ':app'. > [CXX1101] NDK at C:\Users\zeyne\AppData\Local\Android\Sdk\ndk\27.1.12297006 did not have a source.properties file * 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 generate a Build Scan (Powered by Develocity).
    Get more help at https://help.gradle.org.
    BUILD FAILED in 2s error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * Where: Bui ld file 'C:\cprg303\cprg303LabAssignments\android\build.gradle' line: 21 * What went wrong: A problem occurred evaluating root project 'cprg303LabAssignments'. > Failed to apply pl ugin 'com.facebook.react.rootproject'. > A problem occurred configuring project ':app'. > [CXX1101] NDK at C:\Users\zeyne\AppData\Local\Android\Sdk\ndk\27.1.12297006 did not have a source.properties file * 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 generate a Build Scan (Powered by Develocity). > Get more help at https://help.gradle.org. BUILD FAILED in 2s. info Run CLI with --verbose flag for more details. hi how can I fix this build error I have a lab due on friday and having diffuculties
    🧵 2
    v
    • 2
    • 3
  • c

    Caleb Cushing

    10/29/2025, 1:19 AM
    so the whole daemon-jvm thing doesn't work out of the box?
    Copy code
    ./gradlew updateDaemonJvm --jvm-version=21
    Copy code
    Configuration cache state could not be cached: field `__toolchainDownloadUrls__` of task `:updateDaemonJvm` of type `org.gradle.buildconfiguration.tasks.UpdateDaemonJvm`: error writing value of type 'org.gradle.api.internal.provider.DefaultMapProperty'
    😢 3
    v
    • 2
    • 33
  • c

    Colton Idle

    10/29/2025, 9:31 PM
    Trying to sanity check that I understand the gradle lingo here A precompiled script plugin can be a convention plugin. so all convention plugins are precompiled script plugin but not all precompiled script plugin are convention plugins. A precompiled script plugin goes into 1 of 2 spots • dedicated
    buildSrc
    directory in your build • separate included build (can be named
    build-logic
    for example but an included build is also == composite build
    m
    e
    e
    • 4
    • 36
  • p

    Philip W

    10/30/2025, 6:33 AM
    How does the tooling api work in detail? Does it reuse the Gradle daemon or the host JVM? And what Gradle version will be used? The one specified in the Wrapper?
    👀 1
    s
    v
    • 3
    • 12
  • c

    Caleb Cushing

    10/30/2025, 1:07 PM
    only happening since 9.2, the weird thing is it's not happening locally although I got an even weirder first run error locally. It might be related
    Copy code
    java.lang.IllegalArgumentException: Cannot have abstract method FileSystemLocationProperty.getAsFile(): Provider<File>.
    full stack/repo https://github.com/xenoterracide/gradle-semver/actions/runs/18941346345/job/54080662841?pr=494#step:5:437
    Untitled.java
    m
    v
    • 3
    • 99
  • c

    Colton Idle

    10/30/2025, 1:40 PM
    I'm slowly converting a bunch of files from groovy to kts. One thing that has a bunch of conflicting information about it seemingly is how to take values from gradle.properties and reference them in a kts file. For example... in our settings.gradle we have some maven repositories declared that require a username and password. When I convert to settings.gradle.kts I can't reference those variables directly anymore. Can anyone confirm what the right way to reference a prop in gradle.properties (either in the project or global)? Essentially now I have
    Copy code
    awsRepoUrl=<https://1234567890.d.codeartifact.us-east-1.amazonaws.com/maven/my-repo/>
    awsUsername=aws
    awsPassword=eyJ0eXAiOiJKV1QiLCJh...
    and
    Copy code
    maven {
      url = uri(awsRepoUrl)
      credentials {
        username = awsUsername
        password = awsPassword
      }
    }
    n
    e
    v
    • 4
    • 10
  • c

    Chris Lee

    10/31/2025, 12:40 AM
    Bitten by the default permissions / reproducible archive changes in Gradle 9 -
    distZip
    no longer pulls the filesystem permissions. We could force that via
    useFileSystemPermissions
    but seems cleaner to set the explicit/desired permissions in the build script. But doing that seems to be incompatible with the configuration cache. Seems like
    filePermissions
    is incompatible with configuration cache?
    Copy code
    plugins {
        application
    }
    
    tasks.named<Zip>("distZip") {
        // setting permissions here fails as properties are finalized already
    //    filesMatching("**/*") {
    //        filePermissions {
    //            unix("rwxr-xr-x")
    //        }
    //    }
    }
    
    distributions {
        main {
            contents {
                filesMatching("bin/**") {
                    // simply adding "filePermissions" fails
                    // Cause: class org.gradle.api.internal.file.copy.DefaultCopySpec cannot be cast to class org.gradle.api.file.FileCollection (org.gradle.api.internal.file.copy.DefaultCopySpec and org.gradle.api.file.FileCollection are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @3043fe0e)
                    filePermissions {
                        unix("rwxr-xr-x")
                    }
                }
            }
        }
    }
    v
    • 2
    • 8
  • m

    Maksym Moroz

    10/31/2025, 2:20 PM
    Copy code
    Calculating task graph as configuration cache cannot be reused because init script '../../../../private/var/folders/32/33qr05gj24jbrq7qvg4c1fjh0000gn/T/ijJvmDebugger1.gradle' has changed.
    Any idea what might be causing this to happen from time to time?
    v
    v
    • 3
    • 4
  • b

    Bob Ham

    10/31/2025, 2:40 PM
    How do I extend an existing task with my own bits? I've tried
    originalTask.dependsOn myBits; myBits.shouldRunAfter originalTask
    but
    myBits
    still runs before
    originalTask
  • b

    Bob Ham

    10/31/2025, 2:44 PM
    I tried using
    task.named
    to create my bits but I get an error:
    The task '...' (org....Task) is not a subclass of the given type
    🧵 1
    v
    n
    • 3
    • 68
  • b

    Bob Ham

    10/31/2025, 3:39 PM
    I'm trying to use the spdx-gradle-plugin but I'm getting an error trying to extend it. Here's the relevant snippet:
    Copy code
    spdxSbom {
        targets {
            create("release") {
                configurations.set(["projectCustReleaseRuntimeClasspath"])
            }
        }
    }
    
    python.pip 'spdx_tools:0.8.3'
    
    tasks.register("convertSpdxRelease", PythonTask) {
        ...
    }
    spdxSbomForRelease.finalizedBy convertSpdxRelease
    convertSpdxRelease.dependsOn spdxSbomForRelease
    and here is the error:
    Copy code
    * What went wrong:
    A problem occurred evaluating root project 'CustKeyboard_Studio'.
    > Could not create task ':spdxSbomForRelease'.
       > Configuration with name 'projectCustReleaseRuntimeClasspath' not found.
    The task works fine if I comment out the
    configurations.set(...
    or if I comment out both the
    finalizedBy
    and
    dependsOn
    statements. Anyone have a clue as to why that might be?
    n
    v
    • 3
    • 18
  • a

    Anish Sandeep Bhargav

    10/31/2025, 8:50 PM
    Hi, I Was Making My Minecraft Mod I Don't Really Have That Great Knowledge About These Programming Languages So I Had Generated The Code From AI And I Am Getting These Errors I Have Checked My All Files Codes And I Have Know Errors But While Using ./gradlew build, ./gradlew runClient I See This Error
    v
    • 2
    • 1
  • н

    Николай Клебан

    11/03/2025, 7:26 PM
    Can someone help me understand why two Gradle daemons are being spawned when I run for i.e. “Clean Project” in Android Studio in a project with
    build-tools
    as includedBuild? I’ve configured the AS to use the Gradle wrapper (version 8.14.3), but for some reason, another daemon starts up using the 9.0-milestone-1 distribution.
    • 1
    • 1
  • m

    Mike Wacker

    11/03/2025, 10:35 PM
    Is there a way to express a task dependency of the form: "only run if the dependent task is out-to-date"? I.e., I want to run the
    composeUp
    task for the
    avast.gradle.docker-compose
    to run first if the
    test
    task is out-of-date, but it (and the
    composeDown
    task) should abe skipped if the
    test
    task is skipped. Context: https://github.com/avast/gradle-docker-compose-plugin/issues/453
    v
    a
    • 3
    • 11
  • a

    Andy Damevin

    11/05/2025, 7:20 PM
    Hello! For some obscure reason, Gradle is not using my .module file by default but the pom instead: https://repo1.maven.org/maven2/io/mvnpm/esbuild-java/2.0.0-beta-2/ If I set this it works:
    Copy code
    mavenCentral()  {
            metadataSources {
                gradleMetadata()
                mavenPom()
            }
        }
    the weird thing is that for other repos such as guava or junit, it does look for the .module file in central even without this conf. I might be missing something..
    Copy code
    2025-11-05T20:17:32.455+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Metadata of <https://repo.maven.apache.org/maven2/io/mvnpm/esbuild-java-native-deps/2.0.0-beta-2/esbuild-java-native-deps-2.0.0-beta-2.pom>'
    2025-11-05T20:17:32.456+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Metadata of <https://repo.maven.apache.org/maven2/io/mvnpm/esbuild-java-native-deps/2.0.0-beta-2/esbuild-java-native-deps-2.0.0-beta-2.pom>' completed
    
    ...
    
    2025-11-05T20:17:32.308+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Metadata of <https://repo.maven.apache.org/maven2/com/google/guava/guava/33.5.0-jre/guava-33.5.0-jre.module>'
    2025-11-05T20:17:32.308+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Metadata of <https://repo.maven.apache.org/maven2/com/google/guava/guava/33.5.0-jre/guava-33.5.0-jre.module>' completed
    t
    j
    +4
    • 7
    • 67