Uploaded image for project: 'Gradle'
  1. Gradle
  2. GRADLE-3330

Fails to resolve multiple configurations of the same project when 'archiveName' is specified

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 2.5, 2.6, 2.7, 2.8, 2.9
    • Fix Version/s: 2.10-rc-1

      Description

      I have discovered an issue in the gradle 2.5 and 2.6-RC2 with multi-project builds. Or perhaps is a feature. smile Anyway, what works with gradle 2.3 and 2.4 does not work anymore with gradle 2.5+.

      I have created a small project that can reproduce the issue. It consists of a root project with two-subprojects

      root_project
      -> core
      -> petshop
      settings.gradle
      

      The root project has only the settings.gradle file:

      include "core"
      include "petshop"
      

      The core project has the following build.gradle:

      apply plugin: 'java' 
      configurations{
          cats
      }
      sourceSets {
          cats 
      }
      dependencies {
          catsCompile project(':core')
      }
      jar {
          archiveName = "animals.jar"
      } 
      task createCats(type: Jar) {
          from sourceSets.cats.output
          archiveName "cats.jar"
      }
      artifacts {
          cats createCats
      }
      

      The core sub-project produces two artifacts: the default animals.jar and the cats.jar from the cats configuration.

      The petshop project build.gradle:

      apply plugin: 'java'
      dependencies {
          compile project(':core') // required animals.jar
          compile project(path: ':core', configuration: 'cats')  // required cats.jar
      }   
      jar {
          archiveName = "petshop.jar"
      }
      

      The petshop project requires for compilation both animals.jar and cats.jar. But it seems that gradle places just one of the dependencies in the class-path of the petshop project. Depending of the order of the dependencies, the build fails finding classes from the animal.jar or cats.jar.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            big-guy Sterling Greene
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: