# Lazy configuration resolution with artifact repack

**URL:** https://discuss.gradle.org/t/lazy-configuration-resolution-with-artifact-repack/12747
**Category:** Help/Discuss
**Created:** [November 13, 2015, 12:32pm UTC](https://discuss.gradle.org/t/lazy-configuration-resolution-with-artifact-repack/12747 "2015-11-13T12:32:14Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![sterling](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/sterling/32/5395_2.png) [@sterling](https://discuss.gradle.org/u/sterling)
#### Post date: [November 14, 2015, 3:46am UTC](https://discuss.gradle.org/t/lazy-configuration-resolution-with-artifact-repack/12747/2 "2015-11-14T03:46:00Z")

</div>

Yes, that’s a common pattern:

> [@Right way to copy contents from dependency archives?](https://discuss.gradle.org/t/right-way-to-copy-contents-from-dependency-archives/7449/13):
>
> An idiomatic solution would look like this: configurations { api } dependencies { api 'somegroup:someArtifact:someVersion' } task extractApi(type: Sync) { dependsOn configurations.api from { // use of closure defers evaluation until execution time configurations.api.collect { zipTree(it) } } into "$buildDir/api/" }

The closure delays resolving the configuration unless it’s used.

---

_[View the full topic](https://discuss.gradle.org/t/lazy-configuration-resolution-with-artifact-repack/12747)._
