How to get absolute path of a file declared in dependencies?

You can get the paths of all files in a configuration by calling the Configuration.resolve() method.

repositories{
 mavenCentral()
}
configurations{
 runtime
}
dependencies {
 runtime 'commons-lang:commons-lang:2.6'
}
  println configurations.runtime.resolve()