Gradle fails to resolve dependencies when using archivesBaseName

A snippet of my original build.gradle file for ‘ProjectA’ (foldername: ProjectA) has -

apply plugin: 'java'
 group = 'myGroup'
 archivesBaseName = 'ProjectA-abc'
 version = 'SNAPSHOT'

This results in a jar artifact named ProjectA-abc-SNAPSHOT.jar

I am using the gradle-artifactory plugin to publish to an Artifactory repo. The upload url looks like this -

In a separate project, that consumes ProjectA’s jar, my build.gradle has -

 dependencies {
         compile(group: 'myGroup', name: 'ProjectA', version: 'SNAPSHOT', ext: 'jar')

When I type gradle build, the build fails to resolve the dependency. Analyzing the Gradle log shows that it’s trying to do a GET request to the resource at , which does not exist and fails!

Changing the above dependency to use name: ‘ProjectA-abc’ , instead, leads to another similar failure -

 dependencies {
         compile(group: 'myGroup', name: 'ProjectA-abc', version: 'SNAPSHOT', ext: 'jar')

The GET request in this case is to the resource at , which does not exist and fails too!

Is there a way I could influence the url that is being constructed (or the artifactId) so that consumers of my artifacts can get to my Project-abc-SNAPSHOT.jar without fail? Something like = ‘Project-abc’ instead of using archivesBaseName property from the java plugin. What Project properties (project.artifactId?) could I use instead of using archivesBaseName?

This is GRADLE-443, which will be fixed in 1.1. Meanwhile you have two options:

  • Set project name (in settings.gradle) to the artifact ID you wish to publish under, rather than setting archivesBaseName. Note that this doesn’t necessarily mean that you’ll have to change the project directory’s name, since that name can be customized too (again in settings.gradle). * Customize the POM of the depending project to use the correct artifact ID (see user guide on how to customize POM content)

Thanks, that works! In my multi-project build I added this to my root settings.gradle -

include 'ProjectA'
//added the following -
project(':ProjectA').name = 'ProjectA-abc'