Sergey Shcherbakov
Sergey Shcherbakov

Reputation: 4778

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!

Upvotes: 4

Views: 3602

Answers (1)

Peter Niederwieser
Peter Niederwieser

Reputation: 123910

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).

Upvotes: 5

Related Questions