# Copy all dependencies of implementation configuration fails

**URL:** https://discuss.gradle.org/t/copy-all-dependencies-of-implementation-configuration-fails/26666
**Category:** Help/Discuss
**Created:** [April 19, 2018, 11:43am UTC](https://discuss.gradle.org/t/copy-all-dependencies-of-implementation-configuration-fails/26666 "2018-04-19T11:43:43Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![AlStrk](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@AlStrk](https://discuss.gradle.org/u/AlStrk)
#### Post date: [April 19, 2018, 11:43am UTC](https://discuss.gradle.org/t/copy-all-dependencies-of-implementation-configuration-fails/26666/1 "2018-04-19T11:43:43Z")

</div>

How can I copy all configurations of the implementation configuration into a separate folder?  
Since “compile” configuration is deprecated I changed all dependencies to “implementation”, but now the copy job fails. I also changed my copy task from configurations.compile to configurations.implementation:

ext.libDir = ‘build/lib’  
task copyDependencies(type: Copy) {  
into libDir  
from configurations.implementation  
}

When I execute the task, I get an error:

- What went wrong:  
Could not determine the dependencies of task ‘:mobile:copyDependencies’.

> Resolving configuration ‘implementation’ directly is not allowed

It worked before with configurations.compile.

I’m using Gradle 4.1 and Android Gradlre Plugin 3.0.1

If there is another way to copy all dependencies of my project in a separate folder I would be very happy for any idea.

Thanks

---

<div class="post-metadata">

### Author: ![st\_oehme](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/st_oehme/32/5249_2.png) [@st\_oehme](https://discuss.gradle.org/u/st_oehme)
#### Post date: [April 19, 2018, 12:31pm UTC](https://discuss.gradle.org/t/copy-all-dependencies-of-implementation-configuration-fails/26666/2 "2018-04-19T12:31:55Z")

</div>

`implementation` can’t be resolved, because it doesn’t know if you want the api or runtime dependencies. Use `compileClasspath` or `runtimeClasspath` instead, depending on what you need.

---

<div class="post-metadata">

### Author: ![AlStrk](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@AlStrk](https://discuss.gradle.org/u/AlStrk)
#### Post date: [April 19, 2018, 12:54pm UTC](https://discuss.gradle.org/t/copy-all-dependencies-of-implementation-configuration-fails/26666/3 "2018-04-19T12:54:19Z")

</div>

Thanks for the response.  
I already tried these properties but won’t work.  
In both cases I get the error:

A problem occurred evaluating project ‘:mobile’.

> Could not get unknown property ‘compileClasspath’ for configuration container of type org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.  
> or  
> Could not get unknown property ‘runtimeClasspath’ for configuration container of type org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.

I’m using flavors (beta and production) and, of course, build types (debug and release). Maybe this is a relevant information

---

<div class="post-metadata">

### Author: ![st\_oehme](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/st_oehme/32/5249_2.png) [@st\_oehme](https://discuss.gradle.org/u/st_oehme)
#### Post date: [April 19, 2018, 1:25pm UTC](https://discuss.gradle.org/t/copy-all-dependencies-of-implementation-configuration-fails/26666/4 "2018-04-19T13:25:17Z")

</div>

You’ll need to use the Configuration for the Android variant that you care about then. Or create a task that collects the dependencies from all variants. It depends on what you are trying to do.

---

<div class="post-metadata">

### Author: ![AlStrk](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@AlStrk](https://discuss.gradle.org/u/AlStrk)
#### Post date: [April 19, 2018, 2:05pm UTC](https://discuss.gradle.org/t/copy-all-dependencies-of-implementation-configuration-fails/26666/5 "2018-04-19T14:05:17Z")

</div>

If I try this

from configurations.productionReleaseRuntimeClasspath

I get the following error:

> Could not get unknown property ‘productionReleaseRuntimeClasspath’ for configuration container of type org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.

---

<div class="post-metadata">

### Author: ![st\_oehme](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/st_oehme/32/5249_2.png) [@st\_oehme](https://discuss.gradle.org/u/st_oehme)
#### Post date: [April 19, 2018, 7:44pm UTC](https://discuss.gradle.org/t/copy-all-dependencies-of-implementation-configuration-fails/26666/6 "2018-04-19T19:44:44Z")

</div>

Your code is running before the Android plugin creates its configurations. It only creates them once it knows all the flavors and build types. You’ll have to use some lazy construct to forward-reference it, e.g `configurations.matching { name == ... }` or you have to use `afterEvaluate {}` to be called after the Android plugin has created its configurations and tasks.
