spotbugs-gradle-plugin icon indicating copy to clipboard operation
spotbugs-gradle-plugin copied to clipboard

Gradle 8.1.1: Resolution of the configuration ... was attempted from a context different than the project context

Open matthiaskraaz opened this issue 2 years ago • 3 comments

I get lots and lots of message of this type for varying configurations:

Resolution of the configuration :jsource:osis:runtime:server:spotbugsPlugins was attempted from a context different than the project context. Have a look at the documentation to understand why this is a problem and how it can be resolved. This behavior has been deprecated. This will fail with an error in Gradle 9.0. See https://docs.gradle.org/8.1.1/userguide/viewing_debugging_dependencies.html#sub:resolving-unsafe-configuration-resolution-errors for more details

After a little drilldown I realize that this is probably not caused by the spotbugs plugin but the dependencycheck plugin, because the message is created FOR a spotbugs configuration, but also when executing just the dependencyCheckAggregate Task.

matthiaskraaz avatar Jun 27 '23 11:06 matthiaskraaz

Could you share a mcve project to reproduce this issue? Thanks for your report!

KengoTODA avatar Aug 10 '23 11:08 KengoTODA

I could not create a MCVE without dependency check. I am absolutely sure now, that depdenceny check is the culprit!

However, while trying to create the MCVE I stumbled about this:

plugins {
  id 'com.github.spotbugs' version '5.0.14'
}

apply plugin: 'java'

repositories {
  mavenCentral()
}

spotbugsMain {
/* Generates a warning:

The org.gradle.util.ClosureBackedAction type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.2.1/userguide/upgrading_version_7.html#org_gradle_util_reports_deprecations
        at build_a3rrfjmmvkuarj48u4gn03nvt$_run_closure2.doCall(C:\Users\MatthiasKraaz\temp\spotbugs_mcve\build.gradle:12)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
*/
  reports {
    xml.enabled = true
  }
/* Generates no warning:

  configure(reports) {
    xml.enabled = true
  }
*/
}

Not sure if this concerns you somehow. If it does, I can supply a MCVE for this...

matthiaskraaz avatar Aug 10 '23 14:08 matthiaskraaz

The org.gradle.util.ClosureBackedAction type has been deprecated

It is a known issue, #616, waiting for action on the Gradle side. I think it is not related to the problem you met firstly. 🤔

KengoTODA avatar Aug 11 '23 07:08 KengoTODA