Copy project dependencies to folder

Viewed 153

I new to Gradle. I'm trying to have all dependencies from my project copied to folder build/lib. Is it possible to do that?

Currently, I have a .zip and a .tar in build/distributions via the distribution plugin. However, I would like to have just the uncompressed libs.

I've seem a possible solution here, however I would like to have this as part of the main build and not as a separated task.

1 Answers

Just add the task as a dependency to build. That way it will be "part of the main build".

task copyDependencies(type: Copy) {
  from configurations.runtimeClasspath // And/or:
  from configurations.compileClasspath
  into "$buildDir/lib"
}
build.dependsOn copyDependencies

You can, of cause, also hook it up to any other task that you use to build or deploy the application.

Just in case you are not aware of it, you can also use the installDist task from the distribution plugin (in combination with the application plugin) to create an exploded version in $buildDir/install.

Related