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

    Slackbot

    07/09/2023, 10:17 AM
    This message was deleted.
    a
    e
    g
    • 4
    • 9
  • s

    Slackbot

    07/10/2023, 8:54 AM
    This message was deleted.
    n
    b
    v
    • 4
    • 6
  • s

    Stefano Zanella

    08/26/2024, 1:48 PM
    I have a question about exposing artifacts in a multi-project build. Is it possible to make the filename of the exposed artifact dynamic, i.e. set only after execution of the task that generates it? Or does the filename need to be known during the configuration phase? I've been trying to specify the artifact name using a provider but the result is empty. Searching only produces relatively old answers. The context here is that I need to exposed a python package to other sub-projects, but the wheel file specification requires the filename to be very specific and can vary depending on OS/package content/etc. Right now this is the code that works:
    Copy code
    // plugin's apply() method
    
    val buildPythonPackage = project.tasks.register("buildPythonPackage", PythonTask::class.java) {
        ...
    
        it.outputs.file(
            "build/libs/python/${projectConfiguration.name.get()}-${projectConfiguration.version.get()}-py3-none-any.whl"
        )
    }
    
    project.artifacts {
        it.add(CONSUMABLE_CONFIGURATION_NAME, buildPythonPackage)
    }
    I'd like to do something like:
    Copy code
    val dynamicPackagePath = packageOutputDir.map { it.asFileTree.matching { it.include("*.whl") }.singleFile }
    
    val buildPythonPackage = project.tasks.register("buildPythonPackage", PythonTask::class.java) {
        ...
    
        it.outputs.file(dynamicPackagePath)
    }
    
    project.artifacts {
        it.add(CONSUMABLE_CONFIGURATION_NAME, buildPythonPackage)
    }
    But apparently the path provider is resolved already during the configuration phase
    v
    • 2
    • 7
  • h

    Heiko

    08/26/2024, 5:52 PM
    how to set file permissions for some files in a Copy task? I've tried two ways:
    Copy code
    filesMatching("**/*.sh") { filePermissions { user { execute = true } } }
    and
    Copy code
    filePermissions { filesMatching("**/*.sh") { user { execute = true } } }
    neither gives the expected result. First option results in an error
    The value for this property is final and cannot be changed any further.
    while the 2nd option makes all files executable, not just the
    *.sh
    files
    v
    • 2
    • 2
  • j

    Jean Helou

    08/27/2024, 9:39 AM
    Does anyone know how
    configure-on-demand
    is expected to apply in a larger composite build ? the documentation of either feature doesn't mention the other. We are exploring switching a monolithic build with 800 projects to a composite build (about 70 app builds and 5 shared libraries groups builds). However our results so far are quite disappointing. Any configuration cache miss triggers a massively increased configuration phase ( from 2s to 22s in our tests ). the apparent reason is that configuration on demand avoidance seems to be completely lost or to only apply to the main build and not to any of the included builds. We tried the isolated build pre-alpha but without much luck (config time goes down a bit to 10s but still configures way too many projects with regards to the requested tasks) (using gradle 8.9 and kotlin dsl)
    👀 1
  • a

    ASIF KAMRAN MALICK

    08/27/2024, 11:14 AM
    When a project is run (using wrapper command gradlew) from a certain environment say X, it fails to download the gradle wrapper. All I see are the .lck and .part files under the wrapper/dists. It was discovered that Anonymous GET requests from within the X environment to the artifactory instance(distributionURL) are not allowed and as a result fail everytime with an HTTP 401 error. It is now required that every GET request to this artifactory instance from within the environment X must be authenticated. I tried to lookup the documentation for authenticated gradle wrapper download. The documentation suggests using system properties for specifying http Basic auth credentials in gradle.properties or to embed the username:password in the ditributionUrl but neither seems to help. I still get 401 error. The error I am encountering is :
    Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 401 for URL: <the distributionUrl>
    NOTE: I had earlier worked around this wrapper download issue by manually downloading the wrapper on my system(as download ), copying the distribution to the environment X and putting it in the distributionPath By doing so I was able to get the gradle wrapper being recognized and unzipped successfully. However the project build kept failing because the dependencies could no more be downloaded and threw HTTP 401 error. I was able to successfully build the project after passing credentials to my repository configurations. But the wrapper download issue still exists. UPDATE: I discovered that we had been carrying over a pretty old gradle-wrapper.jar. When I replaced it with a more recent one(6.8.3) it started working out of the box and the wrapper was getting downloaded. But I also noticed that for older gradle-wrapper.jar files the output result differed when downloading the corresponding Gradle wrapper: using the gradle-wrapper.jar for Gradle 2.5 : error was HTTP 401,
    Copy code
    Exception in thread "main" java.io.IOException: Server returned HTTP response code: 401 for URL: <distribution-url-goes-here>
            at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
            at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
            at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
            at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
            at org.gradle.wrapper.Download.download(Download.java:44)
            at org.gradle.wrapper.Install$1.call(Install.java:59)
            at org.gradle.wrapper.Install$1.call(Install.java:46)
            at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
            at org.gradle.wrapper.Install.createDist(Install.java:46)
            at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
            at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
    using the gradle-wrapper.jar for Gradle 3.5.1 and any later versions : PASSED I'm testing with above wrapper jars against the distributions Gradle 2.6(trying to upgrade a pretty old build)
    • 1
    • 1
  • s

    Stefano Zanella

    08/27/2024, 2:14 PM
    does anyone have examples they are allowed to share about using Gradle as the main tool for deployments in a multi-project setup? Currently I'm using Gradle to build our projects, but I'm also still using GitHub Actions for the actual deployment. In other words, I have several GH pipelines that in broad terms call
    ./gradlew build
    and then perform the deployment. But with this I need to maintain in the workflow definition the same links between projects that Gradle knows about automatically. And what's worse, that's something expressed by a list of files and directories in a yaml file. So I'm wondering if there's a way to just have a single
    deploy
    task that leverages Gradle's project dependency model, and I'm wondering if anyone did or came across anything similar already
    j
    p
    d
    • 4
    • 11
  • s

    Shridhar Vashishtha

    08/27/2024, 5:29 PM
    I am building apk in android studio and I get the following error: Execution failed for task 'appcheckDebugAarMetadata'.
    Could not resolve all files for configuration 'appdebugRuntimeClasspath'.
    > Could not find org.apache.cordovaframework7.0.0. Any ideas on what's wrong in my gradle?
    v
    • 2
    • 1
  • r

    RAAXAS

    08/27/2024, 6:52 PM
    FAILURE: Build failed with an exception. * What went wrong: Execution failed for task 'device info pluscompileDebugJavaWithJavac'.
    error: invalid source release: 17
  • r

    RAAXAS

    08/27/2024, 6:53 PM
    i am building flutter app but this seem to appear
    🧵 1
  • r

    RAAXAS

    08/27/2024, 6:53 PM
    any help?
    🧵 1
    v
    • 2
    • 1
  • b

    Brayan Licano

    08/28/2024, 5:53 PM
    Hi community support, I created a project with the second Patch of Android and it shows me errors when I selected empty views activity. I provide an image of the errors.
    s
    v
    • 3
    • 2
  • a

    Andrew Grosner

    08/28/2024, 8:34 PM
    hey, is there any documentation or context on what
    executionHistory
    is used for. this file in my repo has grown to 24 GB 😆 is it safe to delete and itll revert to a smaller size?
    v
    • 2
    • 2
  • p

    Peerawat Kuengnog

    08/29/2024, 8:48 AM
    I have installed Flutter on my MacBook M3, as well as Android Studio and Visual Studio Code. After creating a new Flutter project and running it on an Android virtual machine, I encountered the error shown in the attached image. Could you please help me resolve this issue? Execution failed for task 'appcheckDebugAarMetadata'. > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction > /Users/princex/.gradle/caches/transforms-3/eaf431056a8eceaf1bd419c41078d60b/transformed/jetified-appcompat-resources-1.6.1/META-INF/com/android/build/gradle/aar-metadata.properties (No such file or directory)
    c
    • 2
    • 2
  • k

    Ksawery Karwacki

    08/29/2024, 9:37 AM
    Can I refer version catalog in settings? assume i have
    gradle/libs.versions.toml
    with:
    Copy code
    [versions]
    micronaut = "4.2.0"
    can i then refer to this in
    settings.gradle.kts
    like:
    Copy code
    dependencyResolutionManagement {
        versionCatalogs {
            create("mn") {
                from("io.micronaut.platform:micronaut-platform:${libs.versions.micronaut}")
            }
        }
    }
    I would have single source for all versions and catalogs used within projects, to easily handle pulling of those and have automated version management (renovate). I could potentially write convention settings plugin but this only moves problem to another layer.
    v
    p
    • 3
    • 2
  • h

    Horizon

    08/29/2024, 10:16 AM
    I have a problem :
    A problem occurred evaluating project ':app'.
    > Plugin with id 'com.android.application' not found.
    The error line in my app/build.gradle :
    Copy code
    apply plugin: 'com.android.application'
    In my android/build.gradle, i have:
    Copy code
    buildscript {
            ext.kotlin_version = '1.7.20'
            repositories {
                google()
                mavenCentral()
            }
    
            dependencies {
                classpath 'com.android.tools.build:gradle:8.5.0'
                classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
                classpath 'com.google.gms:google-services:4.4.2'
            }
        }
    In my gradle-wrapper.properties, i have:
    Copy code
    distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
    Any help would be greatly appreciated (Im very new to gradle and mobile development
    v
    • 2
    • 5
  • n

    Nithish Varanasi

    08/29/2024, 1:30 PM
    I'm getting the gradle version when i run the ReactNative project Can anyone sort this problem
    v
    • 2
    • 3
  • g

    Garrett Bunch

    08/30/2024, 12:43 AM
    I'm trying to build an android game on Unity 2022.3.42f1. However, I can not build the project onto my phone. "Gradle build failed. See console for details." The console says, Task failed with an exception. ----------- * What went wrong: A problem occurred configuring project ':launcher'.
    compileSdkVersion is not specified. Please add it to build.gradle
    Any help would be appreciated.
    v
    • 2
    • 3
  • z

    zhiqiang zhang

    08/30/2024, 7:10 AM
    Hi, @Vampire . Thank you for your support. Currently, I have still the same error message.
    Copy code
    FAILURE: Build failed with an exception.
    
    * Where:
    Build file 'E:\GrabCoin_1\Library\Bee\Android\Prj\Mono2x\Gradle\launcher\build.gradle' line: 1
    
    * What went wrong:
    A problem occurred evaluating project ':launcher'.
    > Plugin with id 'com.android.application' not found.
    
    * 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 1s
    
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    Also, I can't understand your response yet. Could you explain in detail, please?
    v
    • 2
    • 11
  • p

    Peter

    08/30/2024, 12:28 PM
    Does
    tasks.withType<KotlinCompile>() { ... }
    behave the same as
    tasks.withType<KotlinCompile>().configureEach { ... }
    ? 🤔
    e
    • 2
    • 1
  • j

    Javi

    08/30/2024, 2:13 PM
    Is there a way to override the version used by a plugin which is applied by another plugin and it is added to that plugin to the
    implementation
    configuration?
    v
    • 2
    • 10
  • a

    Aosen Xiong

    08/30/2024, 9:18 PM
    Hi all, I have defined additional sourceset in subproject like the following code
    Copy code
    sourceSets {
        testannotations {
            java {
                srcDirs = ['src/testannotations/java']
            }
        }
    }
    and I want to use it in my root project as a variable
    Copy code
    def javadocDirs = [
        project(':checker').sourceSets.testannotations.allJava,
    ]
    I got the following error
    Copy code
    * What went wrong:
    A problem occurred evaluating root project 'checker-framework'.
    > Could not get unknown property 'testannotations' for SourceSet container of type org.gradle.api.internal.tasks.DefaultSourceSetContainer.
    Any idea to fix it?
    v
    • 2
    • 1
  • s

    Santiago M. Mola

    08/31/2024, 4:38 PM
    is there any way to watch for tasks created later (as in tasks.matching) but keeping lazy configuration? everything I checked suggests there isn't, but I wonder if there's any kind of obscure alternative...
    v
    • 2
    • 17
  • m

    mudkip

    08/31/2024, 10:10 PM
    Hello, I am using the
    com.gradleup.shadow
    plugin. Is it possible to exclude every single class in a package except a few whitelisted ones? From what I am seeing on the docs,
    exclude
    takes priority over
    include
    so I am not sure if this is possible.
    • 1
    • 1
  • s

    Slackbot

    08/31/2024, 11:13 PM
    This message was deleted.
    k
    • 2
    • 5
  • d

    Dante Barbosa

    09/01/2024, 12:17 AM
    Hello everyone I'm having problem with the command ./gradlew signingReport. It gives me the output:
  • d

    Dante Barbosa

    09/01/2024, 12:17 AM
    Hello everyone I'm having problem with the command ./gradlew signingReport. It gives me the output: FAILURE: Build failed with an exception. * Where: Settings file '/Users/setup/Desktop/Project 0/firebaseApp/android/settings.gradle' line: 13 * What went wrong: Error resolving plugin [id: 'com.facebook.react.settings']
    org.gradle.api.internal.catalog.GeneratedClassCompilationException: No Java compiler found, please ensure you are running Gradle with a JDK
    * 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.
    🧵 2
  • d

    Dante Barbosa

    09/01/2024, 1:17 AM
    id: 'com.facebook.react.settings'
    🧵 1
    v
    • 2
    • 2
  • t

    Tcnicn

    09/01/2024, 5:12 PM
    Is there a way to allow a configuration to resolve empty? Ie i would like Configuration.resolve() to return a emtpy Set if no suitable configuration is found or the configuration does not have any artifacts (composite build). Or is there a way to handle such cases somehow? Given the setup below Project A can declare a dependency on Project B using declaredConfiguration. This allows resolvedConfiguration1 to be correctly resolved to the relevant Artifacts. Project B however should not be required to provide an artifact matching resolvedConfiguration2. I want to resolve/use them if they exist but its ok if they dont. Currently i always get "No matching variant of project :projectB was found." errors.
    Copy code
    val declaredConfiguration: NamedDomainObjectProvider<Configuration> = configurations.register("declaredConfiguration") {
        isCanBeResolved = false
        isCanBeConsumed = false
    }
    val resolvedConfiguration1: Provider<Configuration> = configurations.register("resolvedConfiguration1") {
        isCanBeResolved = true
        isCanBeConsumed = false
    
        // attributes
        
        extendsFrom(declaredConfiguration.get())
    }
    val resolvedConfiguration2: Provider<Configuration> = configurations.register("resolvedConfiguration2") {
        isCanBeResolved = true
        isCanBeConsumed = false
    
        // different set of attributes
    
        extendsFrom(declaredConfiguration.get())
    }
    v
    • 2
    • 1
  • y

    Yoga R

    09/01/2024, 7:17 PM
    Can anyone help me to solve this error? I get the following error: FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'android'.
    Could not resolve all files for configuration ':classpath'.
    > Could not find com.android.tools.buildG7.6.3. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.6.3/gradle-7.6.3.pom - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.6.3/gradle-7.6.3.pom Required by: project : > Could not find com.google.gms.google-services4.4.2. Required by: project : * 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.
    BUILD FAILED in 3s Error: Gradle task assembleDebug failed with exit code 1 In my app/build.gradle : apply plugin: 'com.google.gms.google-services' dependencies { implementation(platform("com.google.firebasefirebase bom33.2.0")) } In my android/build.gradle,i have: dependencies { classpath "com.android.tools.buildG7.6.3" classpath "com.google.gms.google-services:4.4.2" }
    v
    • 2
    • 1
1...596061...102Latest