Accessing other module dependency files without "Mutable Project State warnings"

In the functional tests for gradle-pitest-plugin I have a case where classes in the implementation configuration of an another subproject are used. Gradle 5.6.1 reports:

java.lang.IllegalArgumentException: Mutable Project State warnings were found (Set the ignoreMutableProjectStateWarnings system property during the test to ignore):
 - The configuration :itest:mutableCodeBase was resolved without accessing the project in a safe manner.  This may happen when a configuration is resolved from a thread not managed by Gradle or from a different project.  See https://docs.gradle.org/5.6.1/userguide/troubleshooting_dependency_resolution.html#sub:configuration_resolution_constraints for more details. This behaviour has been deprecated and is scheduled to be removed in Gradle 6.0.

for the following configuration:

configure(project(':itest')) {
    apply plugin: "info.solidsoft.pitest"
    dependencies {
        implementation project(':shared')
    }

    //Additional configuration to resolve :shared project JAR as mutable code path for PIT
    configurations {
        mutableCodeBase { transitive false }
        dependencies {
            mutableCodeBase.extendsFrom(project(':shared').configurations.implementation)
        }
    }
    pitest {
        timestampedReports = false
        mainSourceSets = [project.sourceSets.main, project(':shared').sourceSets.main]
        additionalMutableCodePaths = configurations.mutableCodeBase.files //<--- problematic line
    }
}

I could use a workaround:

        additionalMutableCodePaths = project(':shared').jar.outputs.files.getFiles()

but it seems to be even more tricky.

I wonder, if the recommended way is to add another variable in my plugin additionalMutableConfigurations to pass them configurations.mutableCodeBase which would be resolved lazily during the task execution? Or there is some other (better) way?

Hi @Marcin,

Please have a look at this documentation chapter:
https://docs.gradle.org/current/userguide/cross_project_publications.html