Gradle
  1. Gradle
  2. GRADLE-2713

Dependency pulled remotely with same name, group and version as a multiproject subproject results in mysterious hard to fix error

    Details

    • Type: Bug Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.5-rc-2
    • Fix Version/s: None

      Description

      This is a little hard to explain so I will try illustrate with an example. We have a subproject called "grails-datastore-gorm-mongo" that is defined in the same multiproject build as another subproject called "grails-datastore-gorm". The "grails-datastore-gorm-mongo" project declares a dependency on an external jar file not part of the multiproject build:

      compile("org.grails:grails-plugin-domain-class:$grailsVersion")
      

      This dependency transtively depends on "grails-datastore-gorm", which is as I said a project part of the multi project build. What happens is that Gradle actually downloads the published POM for the transitive dependency "grails-datastore-gorm", this is wrong because "grails-datastore-gorm" is part of the current multi-project build.

      The result is a weird error such as

      
      Execution failed for task ':grails-datastore-gorm-mongo:ideaModule'.
      > Could not resolve all dependencies for configuration 'detachedConfiguration4'.
         > Module version group:org.grails, module:grails-datastore-gorm-mongo, version:1.2.0.RELEASE, configuration:detachedConfiguration4 declares a dependency on configuration 'signatures' which is not declared in the module descriptor for group:org.grails, module:grails-datastore-gorm, version:2.0.0.BUILD-SNAPSHOT
      

      This is completely meaningless in describing the actual problem and had me digging into the bugs in the "signing" plugin. The solution for me was to go off and change the dependency declaration, for example:

      compile("org.grails:grails-plugin-domain-class:$grailsVersion") {
          exclude group:"org.grails", module:"grails-datastore-gorm"
      }
      compile project(":grails-datastore-gorm")
      

      Even though this is a solution, and allowed me to proceed this is wrong. I shouldn't have to exclude this transitive dependency as it is part of my current multi project build. I'm actually forced to provide wrong dependency configuration. The issue is compounded by the very bad error message which had me scratching my head for hours.

        Activity

        Hide
        Luke Daley added a comment -

        This would be very difficult to "handle" elegantly given our current publishing and project dependency model. It's likely would could improve the error message though of course.

        We are working towards providing an elegant solution to this with our new publishing model.

        Show
        Luke Daley added a comment - This would be very difficult to "handle" elegantly given our current publishing and project dependency model. It's likely would could improve the error message though of course. We are working towards providing an elegant solution to this with our new publishing model.

          People

          • Assignee:
            Unassigned
            Reporter:
            Graeme Rocher
          • Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:

              Development