# Resolving runtime + compile classpath config

**URL:** <https://discuss.gradle.org/t/resolving-runtime-compile-classpath-config/37145>\
**Category:** Help/Discuss\
**Created:** [August 5, 2020, 12:50pm UTC](https://discuss.gradle.org/t/resolving-runtime-compile-classpath-config/37145 "2020-08-05T12:50:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aloubyansky](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/aloubyansky/32/8321_2.png) [@aloubyansky](https://discuss.gradle.org/u/aloubyansky)\
**Post date:** [August 5, 2020, 12:50pm UTC](https://discuss.gradle.org/t/resolving-runtime-compile-classpath-config/37145/1 "2020-08-05T12:50:17Z")

</div>

In my plugin I need to be resolving project’s Java compile plus runtime dependencies. I used to be resolving JavaPlugin.RUNTIME\_CLASSPATH\_CONFIGURATION\_NAME and then JavaPlugin.COMPILE\_ONLY\_CONFIGURATION\_NAME.  
Now I noticed this warning

```gradle
The compileOnly configuration has been deprecated for resolution. This will fail with an error in Gradle 7.0. Please resolve the compileClasspath configuration instead. Consult the upgrading guide for further information: https://docs.gradle.org/6.5.1/userguide/upgrading_version_5.html#dependencies_should_no_longer_be_declared_using_the_compile_and_runtime_configurations

```

So now I am switching from JavaPlugin.COMPILE\_ONLY\_CONFIGURATION\_NAME to JavaPlugin.COMPILE\_CLASSPATH\_CONFIGURATION\_NAME. That works of course but I have to be filtering out the duplicate deps that constitute probably 99% or even 100% most of the time.  
Perhaps, there is a more efficient and supported way of achieving the same result? Thanks.

---

<div class="post-metadata">

**Author:** ![jjustinic](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/jjustinic/32/9005_2.png) [@jjustinic](https://discuss.gradle.org/u/jjustinic)\
**Post date:** [August 5, 2020, 1:24pm UTC](https://discuss.gradle.org/t/resolving-runtime-compile-classpath-config/37145/2 "2020-08-05T13:24:58Z")

</div>

It sounds like you should create your own configuration that extends from the configurations that you care about. Resolving `compileOnly` directly is deprecated (as is anything green in the diagram below), but the alternative provided, `compileClasspath` is just another configuration that extends from it. You have the option if you want to extend your original `compileOnly` or `compileClasspath` along with `runtimeClasspath`, which when resolved will give you exactly the union of the two, without duplicates.

![](https://global.discourse-cdn.com/gradle/original/2X/f/f2854c9eea2f3e56faba2b6f6358369bf2f410b5.png)

from [Java Plugin - Dependency Configurations](https://docs.gradle.org/current/userguide/java_plugin.html#tab:configurations)

---

<div class="post-metadata">

**Author:** ![aloubyansky](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/aloubyansky/32/8321_2.png) [@aloubyansky](https://discuss.gradle.org/u/aloubyansky)\
**Post date:** [August 5, 2020, 1:45pm UTC](https://discuss.gradle.org/t/resolving-runtime-compile-classpath-config/37145/3 "2020-08-05T13:45:29Z")

</div>

`extendsFrom(...)` was what I needed indeed. Thanks a lot @jjustinic !
