Should project dependencies be showing up in my custom dependency resolutionStrategy handler?

(Doug Lethin) #1

I’ve been trying to troubleshoot something that seems odd to me. I have a mult-module build and each java project has the following:

configurations {
    all {
      resolutionStrategy {
        // add a dependency resolve rule
        eachDependency { DependencyResolveDetails details ->
          if (proj.version.equals(details.requested.version)) {
            println "yo: ${details.requested}"

The version of my project is 8.11.0-SNAPSHOT and my group is “mygroup”. The above just output’s a line indicating what dependencies hit my custom resolutionHandler.

One of my projects in my multi-module builds depends on two other libraries from the build, and the dependencies look like this:

dependencies {
  compile project(':gp-jaxb-types')
  compile project(":admin-client")

When I run my build, I see the following output:

yo: mygroup:gp-jaxb-types:8.11.0-SNAPSHOT
yo: mygroup:admin-client:8.11.0-SNAPSHOT

I’m surprised to see that my internal project dependencies are being passed to my registered resolutionStrategy handler. I thought that was intended for external dependencies only.

As my build/project is rather later and involved, I made a quick attempt to put together a sample project to reproduce this, but I couldn’t reproduce the behavior which is curious.

Should project dependencies be passed to my handler? It doesn’t seem to make sense to me. If so, is there a good recommended way to ignore them?



(Szczepan Faber) #2


The project dependencies are included intentionally. We don’t want to change that.

However, we do want to make the resolution rules api richer. For example, DependencyResolveDetails could have a method like isProjectDependency().

Hope that helps!

(Doug Lethin) #3

Thanks for the response. Yes, isProjectDependency() sounds helpful as this would easily allow me to target my custom override rule only to external dependencies.

Should I file a JIRA ticket for this enhancement request or does that happen automagically somehow through this forum?

In the meantime, it sounds like I need to build up some intelligence into my handler to somehow compare this dependencies with the archives associated with my all my subprojects as a means to ignore them.