Dori
Dori

Reputation: 18413

Copy gradle dependencies to file

I want to have a custom task that allows me to copy all dependencies declared in a block to a folder. Im happy to do this using the stock dependencies closure but even happier if I could use a custom closure to do this.

There is a restriction on my project that at release time I cannot include certain libs / jars via gradle and instead need to bundle them as jars within libs. I have grown used to the ease of Gradle and don't want to go back to manually messing with transitive dependencies and ideally want to be able to just specify the maven identifiers, run a single task and get all jars needed auto downloaded to a file (could be libs) and be done with it.

I have found a few solutions online but none seems to work anymore - gradle has obviously been in rapid development the last couple of years and apis change quickly (or I'm just being stupid). Im currently using gradle 2.3. Many thx for any help :)

Upvotes: 1

Views: 259

Answers (1)

Opal
Opal

Reputation: 84786

You can do it with:

task copyDeps(type: Copy) {
   from configurations.compile // can be different conf name
   into 'libs'
}

Upvotes: 1

Related Questions