Variable describing where Gradle put dependency JARs

Hi all,

Is there a variable, usable in build.gradle, which gives access to where Gradle put dependency JARs ?

For instance:

dependencies {
    implementation 'com.mycompany.mypackage:mydependency:1.0.0'
}

Is there a variable available to access directly to mydependency-1.0.0.jar?

There is not a variable. Your only way to determine where the file is, is to resolve the dependency.

For instance configuration.runtimeClasspath.resolve().find { it.name == 'mydependency-1,0,0.jar'} will resolve that configuration and then return you the loclation of that file. Becasue of this you should only do this during execution time and not configuration time.

If you don’t want to resolve everything, but just the one, you could add the single dependency into a detached configuration and resolve that instead.