Problem Example

ARTIFACTORY: Why is the Artifactory Jenkins plugin only resolving from one repository and how to resolve from the build.gradle settings instead

AuthorFullName__c
Derek Pang
articleNumber
000006093
ft:sourceType
Salesforce
FirstPublishedDate
2024-05-15T07:46:09Z
lastModifiedDate
2024-05-15
VersionNumber
2
2024-05-01T21:04:30.591+0000 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]    > Could not find com.google.guava:guava:32.1.2-jre.
2024-05-01T21:04:30.591+0000 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]      Searched in the following locations:
2024-05-01T21:04:30.591+0000 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]        - https://artifactory.art1.site/artifactory/gradle-libs-none/com/google/guava/guava/32.1.2-jre/guava-32.1.2-jre.pom

You may notice that you are not expecting to find this particular artifact in this repository, “gradle-libs-none” but instead in another repository.
This site is coming from the Jenkins file:
I.e.
…
                rtGradleResolver (
                    id: "GRADLE_RESOLVER",
                    serverId: "artifactory-art1-site-server",
                    repo: gradle-libs-none
                )

…
                rtGradleRun (
                    usesPlugin: true, // Artifactory plugin already defined in build script
                    useWrapper: true,
                    tool: GRADLE_TOOL, // Tool name from Jenkins configuration
                    rootDir: "gradle-examples/gradle-example-publish/",
                    tasks: 'clean artifactoryPublish',
                    deployerId: "GRADLE_DEPLOYER",
                    resolverId: "GRADLE_RESOLVER"
                )

While in the build.gradle you have configured the following repositories:
  repositories {
    maven {
            url "http://arti.test:8081/artifactory/gradle-libs-none"
            setAllowInsecureProtocol(true);
        }    
        maven {
            url "http://arti.test:8081/artifactory/gradle-libs-release"
            setAllowInsecureProtocol(true);
        credentials {
            username "user"
            password "password"
        }
        authentication {
            basic(BasicAuthentication)
        }
    }

The particular artifact is expected to be found at gradle-libs-release but because the plugin has a configured rtGradleResolver and utilizes it in the Gradle run (resolverId: "GRADLE_RESOLVER") that configuration takes precedence over the configurations in the build.gradle.