Giter Site home page Giter Site logo

Cannot change usage of dependency configuration 'xxx' after it has been included in dependency resolution. about gradle-license-plugin HOT 5 OPEN

sergeys-opera avatar sergeys-opera commented on June 2, 2024
Cannot change usage of dependency configuration 'xxx' after it has been included in dependency resolution.

from gradle-license-plugin.

Comments (5)

jaredsburrows avatar jaredsburrows commented on June 2, 2024 1

I have had this plugin applied to a project of mine - https://github.com/jaredsburrows/android-gif-search. It has now been migrated to ksp instead of kapt / annotationProcessor. I have not been able to reproduce this.

I can look into removing these warnings produced by the plugin scanning the configurations.

from gradle-license-plugin.

t-beckmann avatar t-beckmann commented on June 2, 2024

Actually I think setting configuration.isCanBeResolved = true at https://github.com/jaredsburrows/gradle-license-plugin/blob/master/gradle-license-plugin/src/main/kotlin/com/jaredsburrows/license/LicenseReportTask.kt#L161 is not necessary.

from gradle-license-plugin.

jaredsburrows avatar jaredsburrows commented on June 2, 2024

Is this the same as #234? Also, why is configuration.isCanBeResolved = true not necessary?

from gradle-license-plugin.

sergeys-opera avatar sergeys-opera commented on June 2, 2024

Is this the same as #234?

Probably, yes.

My workaround for this issue is:

    // Silence excessive warning messages from "license[Debug|Release]Report" task,
    // see https://github.com/jaredsburrows/gradle-license-plugin/issues/338
    forEachTask(predicate = { it.name == "license${variantName}Report" }) {
        it.notCompatibleWithConfigurationCache("Not implemented")
        (it.logger as ContextAwareTaskLogger).setMessageRewriter { logLevel, message ->
            if (logLevel == LogLevel.WARN && message.startsWith(
                    "Cannot resolve configuration"
                )
            ) null else message
        }
    }

I couldn't get rid of the error messages by using mustRunAfter/dependsOn as suggested in #234. The project where I see the issue is an Android project if that matters.
I also call notCompatibleWithConfigurationCache on the license task as it's not yet (version 0.9.4) compatible with the configuration cache.

from gradle-license-plugin.

t-beckmann avatar t-beckmann commented on June 2, 2024

For those interested, the meaning of those flags is discussed at https://docs.gradle.org/7.5.1/userguide/declaring_dependencies.html#sec:resolvable-consumable-configs.

Setting the isCanBeResolved turns producer and internal configurations to consumers. In the project I am working on doing so has unexpected side-effects on the Gradle build cache, so that it no longer matches!

Admittedly I do not fully understand the effect on the build cache, but I could resolve it by running the license plugin in a separate Gradle invocation separate from all other tasks. My guess is changing isCanBeResolved leads to a different order of dependencies in other configurations...

I am saying changing the flag should not be necessary because a configuration that is not resolvable contributes files to the build only if it is resolved indirectly via some other configuration extending upon it. But in that case the files in question are part of the extending configuration as well and so are picked up by the license plugin nevertheless.

from gradle-license-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.