Could not resolve dependency from Artifactory repository although it's uploaded before

Dear Gradle experts,

unfortunately Gradle is not able to build a project with a dependency which was successfully uploaded to Artifactory before. We use the Artifactory-Gradle plugin to publish and resolve dependencies to Artifactory.

The dependency in this case calls “myplant-ds-integration-0.0.14.jar”. I’ve executed gradle build with debug information and --refresh-dependencies. I’ve tried it with Gradle version 2.3, 2.5 and 2.8 - all with the same result. For me it seems that Gradle is unable to authenticate against the Artifactory repository when the dependency will be resolved. Proxy issues and so on could be eliminated because the upload is working fine with the same settings for the Artifactory repository! Because I’m a new user I can’t paste the debug output because I can just add up to 5 URLs!

Here are is the gradle.properties file which resolve this dependency:


apply plugin: 'java’
apply plugin: 'eclipse’
apply plugin: ‘idea’

apply plugin: 'com.jfrog.artifactory’
apply plugin: ‘maven-publish’

sourceCompatibility = 1.7
targetCompatibility = 1.7

//The Spring XD version is required by the plugin to pull in order to configure dependent libraries that your module project will likely need.
ext {
springXdVersion = ‘1.1.0.RELEASE’ //or a later release of Spring XD
}

repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url “http://repo.spring.io/release
}
maven {
url 'https://devcloud.swcoe.ge.com/artifactory
credentials {
username "${artifactoryUser}"
password “${artifactoryPassword}”
}
}
flatDir {
dirs ‘lib’
}

}

dependencies {
compile ‘com.gejenbacher.myplant:myplant-ds-integration:’ + integrationLibVersion
compile 'com.amazonaws:aws-java-sdk:1.9.23’
compile 'net.jpountz.lz4:lz4:1.2.0’
compile(‘org.springframework.xd:spring-xd-rest-client:1.1.0.RELEASE’)

compile(“org.springframework.xd:spring-xd-dirt:${project.springXdVersion}”) {
exclude group: ‘org.springframework.xd’, module: ‘spring-xd-hadoop’
}

testCompile group: ‘junit’, name: ‘junit’, version: ‘4.11’
}

task copyToLib( type: Copy ) {
into "$buildDir/libs/lib"
from configurations.runtime
}

jar {
dependsOn copyToLib
baseName = artifactName
version = currentVersion
}

task fatJar(type: Jar) {
baseName = project.name + '-all’
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}

buildscript {
repositories {
jcenter()
maven {
url “http://repo.spring.io/release
}
maven {
url 'https://devcloud.swcoe.ge.com/artifactory
credentials {
username artifactoryUser
password artifactoryPassword
}
}
}
dependencies {
classpath(group: ‘org.jfrog.buildinfo’, name: ‘build-info-extractor-gradle’, version: ‘3.1.0’)
}
}

task renameToSnapshotVersion(type: Copy) {
dependsOn jar
from "$buildDir/libs"
into "$buildDir/libs"
rename(artifactName + ‘-’ + currentVersion + ‘.jar’, artifactName + ‘-’ + snapshotVersion + ‘.jar’)
}

publishing {
publications {
mavenJava(MavenPublication) {
groupId 'com.gejenbacher.myplant’
artifactId = jar.baseName
version = jar.version
from components.java
}

    mavenSnapshotJava(MavenPublication) {
        groupId 'com.gejenbacher.myplant'
        artifactId = jar.baseName
        version = snapshotVersion
        from components.java
    }
}

}

artifactory {
contextUrl = ‘https://devcloud.swcoe.ge.com/artifactory

resolve {
    repository {
        repoKey = "${artifactoryRepository}" // The Artifactory repository key to publish to
        username = "${artifactoryUser}" // The resolver user name
        password = "${artifactoryPassword}" // The resolver password
    }
}

publish {
    repository {
        repoKey = "${artifactoryRepository}" // The Artifactory repository key to publish to
        username = "${artifactoryUser}" // The publisher user name
        password = "${artifactoryPassword}" // The publisher password
    }
    defaults {
        // Reference to Gradle publications defined in the build script.
        // This is how we tell the Artifactory Plugin which artifacts should be
        // published to Artifactory.
        publications("${publicationName}")
        publishArtifacts = true
        // Publish generated POM files to Artifactory (true by default)
        publishPom = true
    }
}

}

These are the entries in the gradle.properties file:


artifactName=myplant-ds-integration
currentVersion=0.0.14
snapshotVersion=
publicationName=mavenJava
artifactoryRepository=MYPLANT
artifactoryUser='xxxxx’
artifactoryPassword=‘yyyyy’

Many thanks for your help!

Kind regards

Holger Stanke