Deprecation of Configuration.files(Dependency) in Gradle 8.8

I’m trying to resolve a deprecation warning in a home made/custom gradle plugin written in java.

In this plugin, I’m using the Configuration.files(dependency) method and I’m already trying to replace it with something not deprecated. The documentation states that I should replace this call by:
configuration.getIncoming().artifactView(Action) with a componentFilter

Unfortunately, I was not able to find information in the documentation about the componentFilter and especially how to create one from a java plugin.

Also the migration guide states that:
“Note that contrary to the behavior of the deprecated Dependency filtering methods, componentFilter does not consider the transitive dependencies of the component being filtered. This allows for more granular control over which artifacts are selected.”

As I need these transitive dependencies, what would be the java code to use to return exactly the same results as the deprecated methods ?

1 Like

Unfortunately, I was not able to find information in the documentation about the componentFilter and especially how to create one from a java plugin.

The action you give to the artifact view method is invoked on an ArtifactView.ViewConfiguration instance which has a componentFilter method.