# How to get dependencies programmatically

**URL:** <https://discuss.gradle.org/t/how-to-get-dependencies-programmatically/45690>\
**Category:** Help/Discuss\
**Created:** [May 25, 2023, 3:25pm UTC](https://discuss.gradle.org/t/how-to-get-dependencies-programmatically/45690 "2023-05-25T15:25:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![saravr](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@saravr](https://discuss.gradle.org/u/saravr)\
**Post date:** [May 25, 2023, 3:25pm UTC](https://discuss.gradle.org/t/how-to-get-dependencies-programmatically/45690/1 "2023-05-25T15:25:53Z")

</div>

I want to get the final/resolved dependencies, in fact, a list of artifacts used in a given build (for example, “assembleDebug” in Android). How do I get that?

I ran into examples such as:

```gradle
task dumpDependencies {
  doLast {
    def resolved = configurations.compileClasspath.resolvedConfiguration
    resolved.resolvedArtifacts.each {
      artifact-> println "Artifact: $artifact"
    }
  }
}

```

Above doesn’t work for Gradle 7.5 and I get the error:

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

How do I accomplish what I need?

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [May 25, 2023, 3:47pm UTC](https://discuss.gradle.org/t/how-to-get-dependencies-programmatically/45690/2 "2023-05-25T15:47:00Z")

</div>

`compileClasspath` is more coming from Java projects or similar.  
Pick the right configuration for Android and it will probably work.  
Or if you just want to print it, just use the `dependencies` task, or look at a build `--scan`.

---

<div class="post-metadata">

**Author:** ![saravr](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@saravr](https://discuss.gradle.org/u/saravr)\
**Post date:** [May 25, 2023, 5:12pm UTC](https://discuss.gradle.org/t/how-to-get-dependencies-programmatically/45690/3 "2023-05-25T17:12:42Z")

</div>

Thankyou so much !!! I used a valid configuration like “debugRuntimeClasspath” and it worked!
