# How can I access configurations.runtime in a custom task class using Kotlin DSL

**URL:** <https://discuss.gradle.org/t/how-can-i-access-configurations-runtime-in-a-custom-task-class-using-kotlin-dsl/29284>\
**Category:** Help/Discuss\
**Tags:** plugins\
**Created:** [October 30, 2018, 11:59am UTC](https://discuss.gradle.org/t/how-can-i-access-configurations-runtime-in-a-custom-task-class-using-kotlin-dsl/29284 "2018-10-30T11:59:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johanvergeer](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/johanvergeer/32/7311_2.png) [@johanvergeer](https://discuss.gradle.org/u/johanvergeer)\
**Post date:** [October 30, 2018, 11:59am UTC](https://discuss.gradle.org/t/how-can-i-access-configurations-runtime-in-a-custom-task-class-using-kotlin-dsl/29284/1 "2018-10-30T11:59:42Z")

</div>

I’m working on my first Gradle plugin and I’m running into an issue here.

The plugin should copy all dependencies to the lib directory.

When I implemented this directly in the build script it works fine.

```
task<Copy>("copyToLibs") {
    dependsOn("cleanLibs")
    
    from(compile)
    into("lib")
}

```

I would like to put this into a Gradle plugin.

```
open class CopyToLibTask : Copy() {

    init {
        group = "myFirstPlugin"
    }

    override fun copy() {
        from(????) // What should be put here?
        into("lib")
    }
}

```

I tried to just use `compile`, but that didn’t work.  
On other pages I found something like `configurations.runtime`, but that doesn’t work either, since it doesn’t know `configurations`  
Finally I tried `project.configurations.runtime`. Here I got as far as `project.configurations`, but runtime is not known.

Could someone help me out here?

---

<div class="post-metadata">

**Author:** ![ams\_tschoening](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@ams\_tschoening](https://discuss.gradle.org/u/ams_tschoening)\
**Post date:** [October 30, 2018, 5:13pm UTC](https://discuss.gradle.org/t/how-can-i-access-configurations-runtime-in-a-custom-task-class-using-kotlin-dsl/29284/2 "2018-10-30T17:13:39Z")

</div>

Did you try `project.compile`? I have the feeling that is a task simply returning resulting files.

---

<div class="post-metadata">

**Author:** ![johanvergeer](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/johanvergeer/32/7311_2.png) [@johanvergeer](https://discuss.gradle.org/u/johanvergeer)\
**Post date:** [October 31, 2018, 7:06am UTC](https://discuss.gradle.org/t/how-can-i-access-configurations-runtime-in-a-custom-task-class-using-kotlin-dsl/29284/3 "2018-10-31T07:06:35Z")

</div>

Hi Thorsten,

I just did, but that gave me “Unresolved reference: compile”

```
open class CopyToLibTask : Copy() {

    override fun copy() {
        from(project.compile) // gives "Unresolved reference: compile"
        into("lib")
    }
}
```
