How to query for `provided` scoped dependencies of a configuration?

I have a dependency that has a pom.xml that contains a few <scope>provider</scope>. It doesn’t seem like

In the pom.xml there is:


I’d like to get that dependency transitively and make use of it, by using it in a specific compileOnly of one of projects and other places.

If I do this:

configurations["myConfig"].resolvedConfiguration.resolvedArtifacts.filter { == "javax.servlet-api"
}.forEach {

I don’t see the javax.servlet-api in any of the resolved artifacts.

How do I query for it from the configuration? Or, what is a better way to get it?