# Resolve multi-projects dependencies

**URL:** <https://discuss.gradle.org/t/resolve-multi-projects-dependencies/6250>\
**Category:** Old Forum Archive\
**Created:** [January 31, 2014, 3:09pm UTC](https://discuss.gradle.org/t/resolve-multi-projects-dependencies/6250 "2014-01-31T15:09:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephane\_nicoll](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/stephane_nicoll/32/1089_2.png) [@stephane\_nicoll](https://discuss.gradle.org/u/stephane_nicoll)\
**Post date:** [January 31, 2014, 3:09pm UTC](https://discuss.gradle.org/t/resolve-multi-projects-dependencies/6250/1 "2014-01-31T15:09:00Z")

</div>

I am trying to build a report task similar to ‘org.gradle.api.tasks.diagnostics.DependencyReportTask’ except that I want to generate a file that gives, for each module, the list of dependencies with: groupId, artifactId, version and scope.

Right now a simple CSV will do. I have built the plugin and it produces something that does almost what I want except that I have a lot of dependencies that are unresolved: ‘null’ for the group and version and ‘unspecified’ for the artifact.

I understand we need to go to the resolvedConfiguration to get resolvedDependencies. But I don’t find the information that I want in this model.

Which API should I use? Is there an easy way to filter the internal dependencies from the list (i.e. the modules of the project that another module depends on).

Thanks.

---

<div class="post-metadata">

**Author:** ![bmuschko](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/bmuschko/32/5458_2.png) [@bmuschko](https://discuss.gradle.org/u/bmuschko)\
**Post date:** [January 31, 2014, 8:05pm UTC](https://discuss.gradle.org/t/resolve-multi-projects-dependencies/6250/2 "2014-01-31T20:05:00Z")

</div>

A good starting point is to have a look at the [resolution result](https://github.com/gradle/gradle/blob/master/subprojects/core/src/main/groovy/org/gradle/api/artifacts/result/ResolutionResult.java). Unfortunately, you can’t resolve the artifact (yet). The following example shows the use for the ‘compile’ configuration.

```gradle
task printDependencies << {
    def result = configurations.compile.incoming.resolutionResult
    def externalComponents = result.root.dependencies.selected.findAll { it.id instanceof ModuleComponentIdentifier }
      externalComponents.each { externalComponent ->
        println externalComponent.id.group
        println externalComponent.id.module
        println externalComponent.id.version
    }
}

```

---

<div class="post-metadata">

**Author:** ![carlo\_lf](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/carlo_lf/32/1881_2.png) [@carlo\_lf](https://discuss.gradle.org/u/carlo_lf)\
**Post date:** [February 2, 2014, 12:24pm UTC](https://discuss.gradle.org/t/resolve-multi-projects-dependencies/6250/3 "2014-02-02T12:24:00Z")

</div>

Interesting version, but I get an error using it (using Gradle 1.9):

```gradle
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.github.ben-manes:gradle-versions-plugin:0.1.
     Required by:
         :stuff:unspecified
      > Could not GET 'http://repo1.maven.org/maven2/com/github/ben-manes/gradle-versions-plugin/0.1
/gradle-versions-plugin-0.1.pom'.
         > Permission denied: connect

```

---

<div class="post-metadata">

**Author:** ![bmuschko](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/bmuschko/32/5458_2.png) [@bmuschko](https://discuss.gradle.org/u/bmuschko)\
**Post date:** [February 2, 2014, 4:15pm UTC](https://discuss.gradle.org/t/resolve-multi-projects-dependencies/6250/4 "2014-02-02T16:15:00Z")

</div>

What exactly are you referring to with this output?

---

<div class="post-metadata">

**Author:** ![carlo\_lf](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/carlo_lf/32/1881_2.png) [@carlo\_lf](https://discuss.gradle.org/u/carlo_lf)\
**Post date:** [February 2, 2014, 5:44pm UTC](https://discuss.gradle.org/t/resolve-multi-projects-dependencies/6250/5 "2014-02-02T17:44:00Z")

</div>

I never noticed this (“Could not resolve com.github.ben-manes:gradle-versions-plugin:0.1.”) and I cannot see, why this plugin is needed. I just wanted to try the task.
