# Copy all dependencies \*and\* generated artifacts to directory

**URL:** <https://discuss.gradle.org/t/copy-all-dependencies-and-generated-artifacts-to-directory/13889>\
**Category:** Help/Discuss\
**Created:** [January 19, 2016, 4:27am UTC](https://discuss.gradle.org/t/copy-all-dependencies-and-generated-artifacts-to-directory/13889 "2016-01-19T04:27:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FredClausen](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/fredclausen/32/3772_2.png) [@FredClausen](https://discuss.gradle.org/u/FredClausen)\
**Post date:** [January 19, 2016, 4:27am UTC](https://discuss.gradle.org/t/copy-all-dependencies-and-generated-artifacts-to-directory/13889/1 "2016-01-19T04:27:54Z")

</div>

Hello All,

I’m using the Java plugin to build an app and I’d like to copy all dependencies _and_ the resultant Jar files to a “lib/” directory for use by some wrapper scripts. I have the following

```gradle
task install(type: Copy) {
  dependsOn build
  from configurations.runtime
  into "${project.projectDir}/script/lib"
}

```

however this copies all dependencies except for the app itself. How can I copy the app itself as well? I read that the Java plugin has an “archives” configuration that might have the produced artifact but adding `from configurations.archives` does not result in the app artifact being present in the target directory.

---

<div class="post-metadata">

**Author:** ![Francois\_Guillot](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/francois_guillot/32/8566_2.png) [@Francois\_Guillot](https://discuss.gradle.org/u/Francois_Guillot)\
**Post date:** [January 19, 2016, 7:13pm UTC](https://discuss.gradle.org/t/copy-all-dependencies-and-generated-artifacts-to-directory/13889/2 "2016-01-19T19:13:05Z")

</div>

Hi @FredClausen

You can do the following

> task install(type: Copy) {  
> dependsOn build  
> from configurations.runtime  
> **from jar**  
> into “${project.projectDir}/script/lib”  
> }

Indeed, the `from` method of the `Copy` task evaluates its argument as per `Project.files()`, and `Project.files()` can task a task as input. It resolves the call to the output of the task.  
You can of course create another `Jar` task, if the default `jar` task does not suit your need.

---

<div class="post-metadata">

**Author:** ![FredClausen](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/fredclausen/32/3772_2.png) [@FredClausen](https://discuss.gradle.org/u/FredClausen)\
**Post date:** [January 21, 2016, 5:24am UTC](https://discuss.gradle.org/t/copy-all-dependencies-and-generated-artifacts-to-directory/13889/3 "2016-01-21T05:24:41Z")

</div>

Thanks! That did the trick.
