Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-12701

Support the new Gradle resolution convention

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Resolution: Deferred
    • Affects Version/s: 4.13.0, 4.13.2
    • Fix Version/s: None
    • Component/s: Gradle
    • Labels:
      None

      Description

      Gradle introduced with version 3.x a new resolution spec: Not using the buildScript but instead using the pluginRepositories in the settings.gradle. For example:

      pluginRepositories {
         maven {
            url 'http://localhost:9090/artifactory/gradle-maven'
          }
        //  gradlePluginPortal()
      }
      
      

      Here you can find more information regarding the new spec: https://docs.gradle.org/3.1/userguide/plugins.html#sec:subprojects_plugins_dsl

      This convention find the artifacts with id. The request that Artifactory tried to resolve is using the following path in the URL:

      /com.jfrog.artifactory.gradle.plugin/4.4.7/com.jfrog.artifactory.gradle.plugin-4.4.7.pom

      This is the ID and not the actual resolution of the artifact.
      For example, resolving Artifactory plugin for Gradle, uses the following URL:

      http://jcenter.bintray.com/com/jfrog/artifactory/com.jfrog.artifactory.gradle.plugin/4.4.7/com.jfrog.artifactory.gradle.plugin-4.4.7.pom

      instead of downloading the build info and its dependencies as it was when using the buildScript:

        buildscript {
        repositories {
          //jcenter()
          
              maven {
            url 'http://localhost:9090/artifactory/gradle-remote'
          }
        }
          dependencies {
          classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.4.7'
      
        }
      
      }
      

      This seems to occur since in the new convention there is only the id:

      id 'com.jfrog.artifactory' version '4.4.7'

      When you use the official Gradle download site:

      pluginRepositories {
          gradlePluginPortal()
      }
      

      This works and the artifacts are being downloaded:

      Download https://plugins.gradle.org/m2/org/jfrog/buildinfo/build-info-extractor-gradle/4.4.7/build-info-extractor-gradle-4.4.7.jar
      Download https://plugins.gradle.org/m2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar
      Download https://plugins.gradle.org/m2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
      Download https://plugins.gradle.org/m2/commons-io/commons-io/2.2/commons-io-2.2.jar
      Download https://plugins.gradle.org/m2/org/codehaus/groovy/groovy-all/2.4.7/groovy-all-2.4.7.jar
      Download https://plugins.gradle.org/m2/commons-lang/commons-lang/2.4/commons-lang-2.4.jar
      Download https://plugins.gradle.org/m2/org/jfrog/buildinfo/build-info-extractor/2.6.3/build-info-extractor-2.6.3.jar
      Download https://plugins.gradle.org/m2/org/jfrog/buildinfo/build-info-client/2.6.3/build-info-client-2.6.3.jar
      Download https://plugins.gradle.org/m2/com/google/guava/guava/18.0/guava-18.0.jar
      Download https://plugins.gradle.org/m2/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar
      Download https://plugins.gradle.org/m2/commons-codec/commons-codec/1.8/commons-codec-1.8.jar
      Download https://plugins.gradle.org/m2/org/apache/httpcomponents/httpcore/4.2.5/httpcore-4.2.5.jar
      Download https://plugins.gradle.org/m2/org/jfrog/buildinfo/build-info-api/2.6.3/build-info-api-2.6.3.jar
      Download https://plugins.gradle.org/m2/org/apache/httpcomponents/httpclient/4.2.5/httpclient-4.2.5.jar
      Download https://plugins.gradle.org/m2/com/fasterxml/jackson/core/jackson-core/2.8.1/jackson-core-2.8.1.jar
      Download https://plugins.gradle.org/m2/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar
      Download https://plugins.gradle.org/m2/com/fasterxml/jackson/core/jackson-databind/2.8.1/jackson-databind-2.8.1.jar
      Download https://plugins.gradle.org/m2/com/fasterxml/jackson/core/jackson-annotations/2.8.0/jackson-annotations-2.8.0.jar
      
      

      Update Jul 2019: still a problem in later versions of Gradle. I used 5.5.1, with the following updated settings.gradle content:

      pluginManagement {
          repositories {
              maven {
                  url 'http://localhost:8081/artifactory/gradle-virtual/'
                  credentials {
                      username = 'jenkins'
                      password = 'password'
                  }
              }
          }
      }
      
      rootProject.name = 'Test'
      

      build.gradle

      plugins {
          id "com.jfrog.artifactory" version "4.9.7"
      }
      

      https://plugins.gradle.org/plugin/com.jfrog.artifactory

      and Artifactory still tries to resolve via:

      20190716202724|76|REQUEST|127.0.0.1|jenkins|HEAD|/gradle-virtual/com/jfrog/artifactory/com.jfrog.artifactory.gradle.plugin/4.9.7/com.jfrog.artifactory.gradle.plugin-4.9.7.jar|HTTP/1.1|404|0
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            alexeiv Alexei Vainshtein
            Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Sync Status

                Connection: RTFACT Sync
                RTMID-12701 -
                SYNCHRONIZED
                • Last Sync Date: