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

    Vladimir Sitnikov

    08/05/2025, 8:30 AM
    The following error is very sad to deal with:
    Copy code
    java.lang.NoClassDefFoundError: org/gradle/util/VersionNumber
    Well, Gradle had
    VersionNumber
    class for quite some time, and it is sad Gradle 9 broke backward compatibility with plugins which still use
    VersionNumber
    from
    org.gradle.util
    I wonder what are the benefits for Gradle to drop the class. My guess is it does not require much efforts to support. It would be so much better if Gradle used something like
    @Deprecated(level=Hidden)
    instead of dropping the class.
    โž• 1
    m
    a
    +2
    • 5
    • 87
  • p

    Pratikshit singh

    08/05/2025, 10:11 AM
    hey
    ๐Ÿ‘‹ 2
  • b

    blubb

    08/05/2025, 2:02 PM
    When I have a conventional plugin and publish it into a local maven repository. Another project wanting to use that plugin needs to include it as dependency, right?
    v
    • 2
    • 56
  • x

    Xeno

    08/05/2025, 3:54 PM
    ๐Ÿ‘‹ Hello, team! I am developing a Gradle plugin designed to resolve dependencies using system artifacts. The plugin is initiated from an init script. I have implemented dependency resolution for plugins in the
    beforeSettings
    phase and for regular dependencies in the
    projectsLoaded
    phase. However, I have been struggling for a while to determine in which hook I should add transitive dependencies for plugins. For example, the plugin (
    com.gradleup.shadow
    ) has the following dependencies: -
    org.vafer:jdependency
    -
    org.apache.logging.log4j:log4j-core
    -
    org.codehaus.plexus:plexus-xml
    -
    org.codehaus.plexus:plexus-utils
    -
    commons-io:commons-io
    -
    org.jdom:jdom2
    -
    org.apache.ant:ant
    All of these dependencies are present in my system, including their artifacts and POM files. Currently, my plugin is unable to resolve transitive dependencies for plugins because I am unsure about the correct hook to use for adding them to the configuration and the precise method to do so. As a result, the build process fails with an error. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':shadowJar'.
    org/vafer/jdependency/Clazzpath
    * Try:
    Run with --stacktrace option to get the stack trace.
    Run with --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 1s 5 actionable tasks: 1 executed, 4 up-to-date and if I add this to build.gradle
    Copy code
    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath("org.apache.ant:ant:1.10.14")
            classpath("org.ow2.asm:asm-commons:9.8")
            classpath("org.ow2.asm:asm:9.8")
            classpath("commons-io:commons-io:2.18.0")
            classpath("org.vafer:jdependency:2.13")
        }
    }
    then I get BUILD SUCCESSFUL in 1s 6 actionable tasks: 6 up-to-date
    Copy code
    Moreover, both attempts were made in an environment without Internet access and with a cleared cache.
    
    Please tell me how to correctly add such dependencies to the configuration using the API so that they fall into the plugin classpath, I will be very grateful
    v
    j
    • 3
    • 34
  • l

    Leroy Anon

    08/05/2025, 4:15 PM
    I am looking for a consultant to help pass a Unity Cloud gradle build... after upgrading a Unity project from 2020.3, to 2021.3. Hope I am in the right channel. ๐Ÿ‘‹
    v
    • 2
    • 3
  • a

    Arthur McGibbon

    08/05/2025, 4:22 PM
    Since moving to Gradle 9, my bash scripts in
    src/main/dist/bin
    lose their exec attribute when being copied into the archive by the distribution plugin. That's a bug isn't it?
    a
    v
    • 3
    • 7
  • a

    Adam

    08/06/2025, 2:09 PM
    If I have two tasks:
    taskB
    depends on
    taskA
    , but
    taskB
    is disabled. When I run
    gradle taskB
    , why does Gradle still run
    taskA
    ? Shouldn't it also be skipped?
    Copy code
    val taskA by tasks.registering {
      doLast {
        println("running $path")
      }
    }
    
    val taskB by tasks.registering {
      enabled = false
      onlyIf { false }
      dependsOn(taskA)
      doLast {
        println("running $path")
      }
    }
    Copy code
    ./gradlew taskB
    > Task :taskA
    running :taskA
    > Task :taskB SKIPPED
    BUILD SUCCESSFUL in 175ms
    v
    x
    • 3
    • 7
  • p

    Philipp Nowak

    08/08/2025, 7:14 AM
    Hi guys, I'm trying to benchmark a gradle build with gradle-profiler using a scenario file containing 2 scenarios. One should use a property from gradle.properties setting it to
    false
    and the other one to
    true
    to see the impact. Is that possible? I thought about using
    system-properties
    but it doesn't seem to be the right one here since it translates to the
    -D
    arg instead of
    -P
    v
    a
    • 3
    • 8
  • l

    Lucas Holden

    08/09/2025, 6:17 AM
    When using attribute-aware variant selection with two configurations extending one another, how do you make the extending configurations use the same variant as the parent?
    Copy code
    dependencies {
      myCfg(project(":common"))
    }
    configurations {
      myCfg {
        canBeResolved = true
        canBeConsumed = false
        attributes {
          attribute(MyAttributes.PLATFORM, "thisPlatform")
          attribute(MyAttributes.SOURCETYPE, "main")
        }
      }
    
      // both of these somehow use :common's default export, which is a different jar to the one myCfg consumes
      compileClasspath.extendsFrom(myCfg)
      runtimeClasspath.extendsFrom(myCfg)
    }
    p
    v
    • 3
    • 10
  • m

    Mohamed Abderraouf ZOUAID

    08/09/2025, 5:49 PM
    Hello, I was working with flutter perfectly, than I cloned a gitlab project on my laptop, then it required me to upgrade flutter version to 3.32.8, after the upgrad, every flutter project cant run and build and shows this error
    Copy code
    Picked up JAVA_TOOL_OPTIONS: -Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
    > Cannot query the value of this provider because it has no value available.
    
    * 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 1m 25s
    Running Gradle task 'assembleDebug'...                             88.4s
    Error: Gradle task assembleDebug failed with exit code 1
    anyone can help me please?
    v
    e
    • 3
    • 4
  • e

    edward ambroce

    08/09/2025, 6:42 PM
    I'm encountering the same problem
    v
    • 2
    • 1
  • m

    Martin

    08/09/2025, 9:28 PM
    Can I silence this?
    Consider enabling configuration cache to speed up this build
    โœ… 1
    a
    m
    • 3
    • 6
  • l

    Lucas Holden

    08/10/2025, 7:16 PM
    How do you set a plugin version as "changing" in the Plugins DSL, so that Gradle re-evaluates it even if the version number hasn't increased?
    v
    • 2
    • 1
  • j

    JP Sugarbroad

    08/11/2025, 5:59 PM
    Ok, I have a stumper. I have a convention plugin. When another (specific) plugin is applied, I want to configure that plugin. But I don't want to constrain the version of that plugin, so I don't want to put it on the classpath of my convention plugin. Is that possible?
    p
    y
    +2
    • 5
    • 64
  • l

    Lucas Holden

    08/11/2025, 7:59 PM
    How do you get access to the Project instance from within an artifact transform? I need it to use information from another plugin.
    m
    v
    • 3
    • 13
  • l

    Lucas Holden

    08/12/2025, 12:27 AM
    How do you publish multiple plugins from a single project? I can declare both of them using
    gradlePlugins.create
    , but they both publish under the same group: the name of the project.
    v
    • 2
    • 2
  • r

    Renรฉ

    08/12/2025, 6:43 PM
    @Jendrik Johannes Whats your current approach to work around that ignored ticket about java toolchains? https://github.com/gradle/gradle/issues/16628#issuecomment-2654688452
  • l

    Lucas Holden

    08/12/2025, 8:43 PM
    I'm trying to set up an artifact transform where one of the "to" attributes depends on an extension. The problem is, lazy-loading the attribute with
    attributeProvider
    still tries to retrieve the extension property immediately and causes the plugin to fail to apply. (Line 23 of https://paste.ofcode.org/k36CjhiWRKJQkdv2FeyMZz) Running it in
    project.afterEvaluate
    does allow the plugin to be applied, but the artifact transform is unusable due to being applied so late. Does anyone know how to make this work?
    v
    • 2
    • 6
  • j

    James Smith

    08/12/2025, 9:50 PM
    hello all
    ๐Ÿ‘‹ 1
  • j

    James Smith

    08/12/2025, 9:51 PM
    Copy code
    FAILURE: Build failed with an exception.	
    * What went wrong:	
    org.gradle.api.InvalidUserDataException: On plugin declaration 'kotlin' expected to find any of 'id' or 'version' but found unexpected keys 'android' and 'compose'.	
    > On plugin declaration 'kotlin' expected to find any of 'id' or 'version' but found unexpected keys 'android' and 'compose'.	
    * Try:	
    > Run with --stacktrace option to get the stack trace.	
    > Run with --info or --debug option to get more log output.	
    > Get more help at <https://help.gradle.org>.	
    BUILD FAILED in 4
    From what I have in my libs.version.toml
    Copy code
    [plugins]
    android.application = { id = "com.android.application", version.ref = "agp" }
    kotlin.android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
    kotlin.compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
    Can someone explain my issue a little, please?
    m
    v
    • 3
    • 21
  • l

    Lucas Holden

    08/12/2025, 11:16 PM
    I have two configurations extending one another. How do you make sure the sub-configuration actually takes the exact same files as the super-configuration's, instead of going off and resolving completely different variants on its own?
    v
    • 2
    • 8
  • j

    James Smith

    08/12/2025, 11:37 PM
    having trouble for the first time while building my bundle with the key hash discrepancy my gradle.properties file stores the key pass and keystore pass, and when I build, it wants to escape the characters in my password... any solutions, what other info would be needed to help if so?
    v
    • 2
    • 5
  • l

    Lucas Holden

    08/13/2025, 7:42 PM
    I have a
    MapProperty<String, List<Object>>
    in my plugin extension. I need another plugin to merge items into the map instead of overwriting it like
    put
    does. I thought this would work:
    Copy code
    extMap.putAll(extMap.map { m ->
       m.keys.forEach { k ->
          m.merge(k, myValues(), { l1, l2 -> l1 + l2 })
       }
       return@map m
    })
    but instead it causes a stack overflow error due to the value depending on itself. I also can't add elements in
    Project.afterEvaluate
    because
    MapProperty#get
    returns an ImmutableMap. How do I add items to the lists in the map?
    a
    v
    • 3
    • 3
  • t

    tony

    08/15/2025, 5:53 PM
    This is a question about the java-platform plugin (or really, just about dependency constraints), and how that interacts or doesn't with variants. for Gradle projects with test fixtures (more generally: additional variants), do we need to declare the constraint multiple times?
  • b

    Behnam Banaei

    08/16/2025, 7:27 AM
    Hey everyone. We've just migrated our Android team's git repos to a monorepo with the Gradle build system at its root. It consists of 3 large apps and multiple small libraries (150k lines of code in total). The issue is that devs are getting lots of performance issues when opening the monorepo in the Android studio regarding build time and indexing (find usages, navigating in the project, ...). What have we potentially done wrong in the process of migration and what are the solutions for this type of isses?
    v
    • 2
    • 1
  • c

    Caleb Cushing

    08/16/2025, 12:58 PM
    ... what happened to the great propertization ... v9 appears to have fixed zero of my "I need this to be lazy" issues, publishing still appears to be eager, version is eager... checkstyle still compiles java (even though checkstyle itself doesn't need that)
    v
    • 2
    • 2
  • j

    Javi

    08/16/2025, 2:51 PM
    Has someone seen this crash after upgrading to Gradle v9? The full stacktrace does not point to any code I own in my convention plugins ๐Ÿค”
    Copy code
    * What went wrong:
    A problem occurred configuring project ':semver-gradle-plugin'.
    > Failed to notify project evaluation listener.
       > Cannot mutate the hierarchy of configuration ':semver-gradle-plugin:apiElements' after the configuration was published as a variant. After a configuration has been observed, it should not be modified.
       > Gradle Module Metadata can't be modified after an eagerly populated publication.
    v
    • 2
    • 16
  • j

    Javi

    08/17/2025, 10:29 AM
    Hello!
    dependencyProject
    is deprecated but on the deprecation it is not shown any alternative ๐Ÿค”
    v
    • 2
    • 7
  • u

    ู…ุญู…ุฏ ุงุณุงู…ู‡ ุงู„ุจุฏูˆูŠ

    08/17/2025, 11:52 AM
    Hello!
    Copy code
    What is the solution to this error?
    ``````
    v
    • 2
    • 1
  • m

    Mez

    08/17/2025, 10:04 PM
    Hi everyone ๐Ÿค— Our Gradle project has slowly become a mess. An actual ball of spaghetti. Projects depending on projects everywhere with deep paths from our app project to our lowest level project. I tried using a plugin such as this one Graph Assert (https://github.com/jraska/modules-graph-assert) to understand the scale of the problem (it's big) but am struggling to figure out some proper next steps. The goal would be to improve build speeds and enforce a better Gradle graph health going forward. Has anyone faced similar challenges? And would they be able to offer some concrete suggestions for how to plan our way out of this? The project is about 130 modules (Android and Kotlin with some legacy Java) at the moment and takes about 25 minutes to compile on the CI. That's before we start running tests. For example what are some useful things to measure and how? Or what is a repeatable process for refactoring that we can farm it to the entire team including junior engineers that is easy to understand and fool proof? Cheers