Gradle 8.0 compatibility warning

I am getting this warning on my gradle snippet below.

Adding a Configuration as a dependency is a confusing behavior which isn't recommended. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0. If you're interested in inheriting the dependencies from the Configuration you are adding, you should use Configuration#extendsFrom instead. See https://docs.gradle.org/7.2/dsl/org.gradle.api.artifacts.Configuration.html#org.gradle.api.artifacts.Configuration:extendsFrom(org.gradle.api.artifacts.Configuration[]) for more details.

I can understand that I have to remove the dependency on the configuration but dont understand what the recommendation means or is suggesting.

configurations { 
    localDependencies {
      transitive = false
    }
}
dependencies {
    localDependencies group: 'net.java.dev.jna', name: 'jna', version: '5.6.0'
    localDependencies group: 'net.java.dev.jna', name: 'jna-platform', version: '5.6.0'

    implementation configurations.localDependencies
}

This is because I also need the localDependencies configuration somewhere else in the script and dont want to duplicate the dependency file names.

The warning is suggesting you do:

configurations {
    localDependencies {...}
    implementation.extendsFrom( localDependencies )
}

However, I’m not sure if the transitive = false is going to take effect in the same way it did before, so double check the resolved implementation dependencies.

That doesn’t work. I had already tried that

    implementation.extendsFrom(localDependencies)

causes this error:

> Could not get unknown property 'implementation' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Looks like you tried to do that inside dependencies {}. Place it inside configurations {}.