How Can I Access A Jar in $GRADLE_USER_HOME/caches/ From A Task In build.gradle?

Does Gradle provide any built-in way to access a jar file that I know is in $GRADLE_USER_HOME/caches/jar-3/...?

I want to configure a particular jar as a dependency in build.gradle. Then, knowing Gradle downloaded that jar from a remote repository and put it in its local cache, I want to be able to do something like def fooJar = gradle.caches.jar3.dependency('com.example:foo:0.0.1')...

Is there anything Gradle provides for doing that out-of-the-box? I searched the javadocs and found stuff like RepositoryHandler and FlatDirectoryArtifactRepository that I hoped would do it. But I couldn’t figure out how to use them.

Please help? Thanks.