Get a path to dependencie's jar file

(bogaty_f1) #1

Is it possible to get a path to jarFile which presents a jar file writen in dependencies block?

Sample instance:

apply plugin: 'java'
dependencies {
    testCompile 'org.testng:testng:6.8.1'
  task myTask(){
   // ...
   /// ...
  String getDependenciesPath(){
   // code that gets the path to already compiled TESTNG library...

Basicaly that is because I need to execute a task, which should contain a path to library, which it depends On

(bogaty_f1) #2

found solution:

configurations.compile.each {
        println it

this will show all the jars pathes for this configuration

(uklance) #3

ResolvedArtifact artifact = configurations.testCompile.resolvedConfiguration.resolvedArtifacts.find { == “testng” } def id = println “$artifact.file, $, $, $id.version”