jameslafferty
jameslafferty

Reputation: 2182

Artifactory directory contains dots, can't resolve dependencies with Gradle 6.5

Using 5.4.1, Gradle was able to resolve dependencies of the form:

dependencies {
  implementation "my.groupname:my-project-name:${version}"
}

where the dependency artifacts were stored in jFrog artifactory under:

//my.artifactory.url/my-repo/my.groupname/my-project-name/

If I upgrade my wrapper to 6.5, Gradle isn't able to resolve the dependencies any longer. If the setup were completely under my control, I'd move the artifacts to:

//my.artifactory.url/my-repo/my/groupname/my-project-name/

and be on my merry way. Unfortunately, it's not, so I can't. Is there a straightforward way to workaround it in my project without changing the structure in artifactory? I'm using maven dependency resolution, as well as the id com.jfrog.artifactory plugin at version 4.16.0.

Upvotes: 0

Views: 765

Answers (1)

jameslafferty
jameslafferty

Reputation: 2182

Updated: (The original answer only worked on a hot cache) I was able to resolve the issue by adding an entry to the repositories and also hacking the dependencies a bit section of build.gradle:

repositories {
  // ... other repositories
  maven {
    url "my.artifactory.url/my-repo/"
    artifactUrls "my.artifactory.url/my-repo/my.groupname"
    credentials {
      username = "${artifactory_user}"
      password = "${artifactory_password}"
    }
    metadataSources {
      artifact()
      ignoreGradleMetadataRedirection()
    }
  }
}

dependencies {
  implementation ".:my-project-name:${version}"
}

Initially, I had also included mavenPom() in the metadataSources, but there was an incorrect pom.xml on the other end, so I had to remove it (the groupId in pom.xml was missing).

Upvotes: 2

Related Questions