Cleanest way in Gradle to get the path to a jar file in the gradle dependency cache June 8, 2023 by Tarik Your code can be simplified a bit, for example project.configurations.compile.find { it.name.startsWith("solr-solrj-") }.