Could not resolve all dependencies when publishing multiple artifacts from a single project


(tinkerer.tech) #1

Producer project (producer) publishes 3 different artifacts (A.exe, B.zip, C.zip) using a single confuration into Artifactory repo-

...
artifacts {
       producerArchives file: file("${buildDir}/A.exe"), name: "A", type: 'exe', builtBy: execTaskA
      producerArchives file: file("${buildDir}/B.zip"), name: "B", type: 'zip', builtBy: zipTaskB
      producerArchives file: file("${buildDir}/C.zip"), name: "C", type: 'zip', builtBy: zipTaskC
 }
artifactoryPublish { .. }

When I look inside Artifactory I see all 3 of my artifacts - myGroup/producer/SNAPSHOT- — A.exe — B.zip — C.zip

In my Consumer project (consumer) my dependency block looks like this -

...
dependencies {
        getIt(group: 'myGroup', name: 'producer', version: 'SNAPSHOT', ext: 'exe')
         getIt(group: 'myGroup', name: 'producer', version: 'SNAPSHOT', ext: 'zip')
         /* getIt(group: 'myGroup', name: 'producer', version: 'SNAPSHOT', ext: 'zip')
*/
}

which leads to "Could not resolve all dependencies for configuration ‘:getIt’… " error.

Running with -d (debug log) shows a GET request for resource - GET /artifactory/repo/myGroup/producer/SNAPSHOT/producer-SNAPSHOT.zip

which does not exist, hence the error. How might I approach this differently?


(tinkerer.tech) #2

Any ideas on how to resolve this dependency? Am I missing something obvious?


(Luke Daley) #3

Which formats are you using to publish/consume? Ivy or Maven?


(tinkerer.tech) #4

I’m using the gradle-artifactory plugin to publish my artifacts to a maven repo -

artifactory {
   publish {
      ...
      defaults {
          ...
         publishIvy = false
          publishPom = false
      }
   }
      resolve { .. }
}

I’m unsure if I’d need to modify the POMs.


(Luke Daley) #5

The artifactory plugin is doing something wrong. That is, it’s uploading to the wrong location. You’ll have to ask the developers of that plugin what is going on.

The URLs used to make the request are correct for a Maven repository.


(tinkerer.tech) #6

I’ve resolved it from my consumer project’s build script -

dependencies {
     getIt("myGroup:producer:SNAPSHOT") {
          changing = true
           artifact {
             name = 'A'
             type = 'exe'
              }
          artifact {
             name = 'B'
             type = 'zip'
              }
          ...
     }
}