3
votes

I have an Artifactory (version 4.15.0) instance serving a Maven2 repository with several artifacts. Gradle (version 3.3) resolves and downloads most dependencies just fine. However, some fail to resolve on a odd error where the Gradle Artifactory plugin resolver looks for the wrong URL. What is interesting is the correct URL is used to locate the POM and then when it tries to download the JAR the wrong URL is used.

POM URL

[DEBUG] [org.apache.http.impl.execchain.MainClientExec] Executing request HEAD http://artifactoryLocation:8081/artifactory/libs-release/org/swinglabs/swingx/swingx-all/1.6.5-1/swingx-all-1.6.5-1.pom HTTP/1.1

JAR URL

[DEBUG] [org.gradle.internal.resource.transport.http.HttpClientHelper] Performing HTTP HEAD: http://artifactoryLocation:8081/artifactory/libs-release/org.swinglabs.swingx/swingx-all/1.6.5-1/swingx-all-1.6.5-1.jar

As you can see for some reason the JAR URL used contains . and not /. I am unsure as to why this is happening. The POM is correctly downloaded while the JAR dependencies fail to resolve and download. Any suggestions of fixes?

Another interesting find is that the artifactory-ivy-resolver is being used instead of the artifactory-maven-resolver. As stated the repository is a Maven2 repository in Artifactory and stated as such in the Gradle build.gradle file - nothing is mentioned about Ivy and yet the Ivy resolver is being used. I am unsure if this is part of the problem.

build.gradle

apply plugin: 'java'
apply plugin: 'com.jfrog.artifactory'

repositories {

}

buildscript {
  repositories {
    maven {
        url 'http://artifactoryLocation:8081/artifactory/libs-release'
        credentials {
            username = "${artifactory_user}"
            password = "${artifactory_password}"
        }
    }

    jcenter()
  }
  dependencies {
    //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
    classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
  }
}

dependencies {
  compile 'javax.media:jmf:2.1.1e'
  compile 'com.bbn.openmap:openmap:5.0'
  compile 'org.igniterealtime.smack:smack:3.2.2'
  compile 'org.igniterealtime.smack:smackx:3.2.2'
  compile 'org.swinglabs.swingx:swingx-all:1.6.5-1'
  compile 'gov.nasa.worldwind:worldwind:2.1.0'
}

artifactory {
  contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
  publish {
    repository {
        repoKey = 'libs-release-local'
        username = "${artifactory_user}"
        password = "${artifactory_password}"
        maven = true
    }
  }
  resolve {
    repository {
        repoKey = 'libs-release'
        username = "${artifactory_user}"
        password = "${artifactory_password}"
        maven = true
    }
  }
}
1
Could you post your build.gradle?Martin Linha
And please also post the gradle version.Henry
@MartinLinha I posted the build.gradlewoody
@Henry The Gradle version is 3.3.woody
Having zero experience with artifactory I don't understand why it needs a special plugin to resolve artifacts. With other repo managers this works out of the box.Henry

1 Answers

1
votes

In my projects where I also use Artifactory I use Artifactory Gradle plugin just for publishing. As a source repo definition I use something similar to this:

repositories {
    maven {
        url 'http://artifactoryLocation:8081/artifactory/libs-release'
        credentials {
            username = "${artifactory_user}"
            password = "${artifactory_password}"
        }
    }
}

Try to put it to your build.gradle, please.