Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download transitive dependencies with Gradle

My Gradle project depends on a Jar artifact. I'd like to download dependent Jar together with its own dependencies (transitive for the main project) into a temporary build folder:

configurations {
    myConfig { transitive = true }
}

dependencies {
    myConfig "my-group:my-artifact:0.1.0.BUILD-SNAPSHOT"
}

task copyMyLibs(type: Copy) {
    from configurations.myConfig
    into temporaryDir
}

Unfortunately, I get only my-artifact.jar file in the build/tmp/copyMyLibs folder. I'd like to see there dependencies of the "my-group:my-artifact:0.1.0.BUILD-SNAPSHOT" too.

What would be the most succinct way of expressing that in Gradle?

Thanks!

like image 961
Sergey Shcherbakov Avatar asked Oct 29 '25 12:10

Sergey Shcherbakov


1 Answers

What would be the most succinct way of expressing that in Gradle?

You are already expressing it (transitive = true is the default). Chances are that the dependency doesn't have a descriptor (pom.xml or ivy.xml), or doesn't have any transitive dependencies. Also note that snapshots are cached for 24 hours by default (--refresh-dependencies is one way to overcome that).

like image 90
Peter Niederwieser Avatar answered Oct 31 '25 09:10

Peter Niederwieser