Skip to content

cdancy/gradle-artifactory-rest-plugin

Repository files navigation

Build Status codecov Download Stack Overflow

gradle-artifactory-rest-plugin

Gradle plugin, based on jclouds, for interacting with Artifactory's REST API.

Setup

Plugin is hosted on gradles plugin-portal so build scripts may have to be adjusted to account for this.

plugins {
    id("com.github.gradle.artifactory.rest") version "X.Y.Z"
}

Extension

The artifactoryRest extension is provided to define the endpoint and credentials for connecting to an Artifactory instance. Using the extension, and subsequently exposing this potentially private information, is required only if one does NOT want to use the various means of setting the aforementioned properties noted in the Credentials section below.

Because we are built on top of jclouds we can take advantage of overriding various internal HTTP properties by setting the overrides property or, and in following with the spirit of this plugin, configuring them through System Properties of Environment Variables. Further directions on how to set them through System Properties and Environment Variables can be found HERE.

The properties a given client can configure can be found HERE.

artifactoryRest {
    url { "https://localhost:8081/artifactory" } // Optional and can be sourced from sys-prop/env-var. Default to shown URL.
    credentials { "admin:password" } // Optional and can be sourced from sys-prop/env-var. Default to anonymous auth.

    // Optional and can be sourced from sys-prop/env-var.
    overrides = ["jclouds.so-timeout" : "300000", 
                 "jclouds.connection-timeout" : "300000",
                 "jclouds.retries-delay-start" : "60000",
                 "jclouds.max-retries" : "5" ]
}

Credentials

Because this plugin builds on top of artifactory-rest library one can supply credentials in any form this library accepts. Furthermore, artifactory-rest allows the endpoint and credentials to be optionally supplied through properties or environment variables. This gives great flexibility in the way the user wants to define and/or hide their credentials assuming one does not want to use the artifactoryRest extension.