Skip to content
This repository has been archived by the owner on May 18, 2020. It is now read-only.

ArtifactoryUploadPlugin

Johannes Tandler edited this page Mar 23, 2017 · 7 revisions

Purpose

There are many plugins helping uploading maven artefacts to an maven compatible repository. The BuildMonkey plugins often create complete repositories in Maven structure or as P2 repositories. Uploading them can be a very difficult act. With this plugin it is very easy to deploy complex folder structures to an Artifactory server.

Declaration

Using this plugin needs the following plugin declarations:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "de.monkeyworks.buildmonkey:artifactoryupload:0.4.1"
  }
}

apply plugin: "de.monkeyworks.buildmonkey.ArtifactoryUploadPlugin"

or in the incubating script snippet notation:

plugins {
  id "de.monkeyworks.buildmonkey.ArtifactoryUploadPlugin" version "0.4.1"
}

Configuration

The plugin allows you uploading different folders to any artifactory repository with one configuration. Therefore the configuration closure contains one structure per transmission. A configuration can be look like

artifactoryUploads {
    artifactoryUpload {
        threads         = '1'
        sourceDirectory = "${buildDir}/m2Repository"
        artifactoryURL  = 'https://myArtifactory.myDomain.my/artifactory'
        repositoryPath  = 'Maven/MyProject'
        credentials {
            username    = 'admin'
            password    = 'root'
        }
    }

    artifactoryUpload {
        threads         = '1'
        sourceDirectory = "${buildDir}/p2Repository"
        artifactoryURL  = 'https://myArtifactory.myDomain.my/artifactory'
        repositoryPath  = 'Eclipse/MyProject'
        credentials {
            username    = 'admin'
            password    = 'root'
        }
    }  
}

The parameters for every artifactoryUpload configuration are:

  • threads - Number of uploading threads. The default is 4. If the upload speed is to high, some 404 errors may occurs and some items are not uploaded. Setting this value to a lower value may prevent this.
  • sourceFolder - Root folder to upload. The folder itself is not uploaded, just the content.
  • artifactoryURL - Web URL of the Artifactory server, don't forget the 'artifactory' at the end.
  • repositoryPath - Path of the repository starting at the root of the Artifactory.
  • credentials.username - Name of an artifactory user with granted write access.
  • credentials.password - Password of this artifactory user.

Gradle tasks

The plugin provides 2 task, but extractArtifactoryTooling is only used as preparation tasks for the main task. Because there is no need to configure this task or call it explicitely, there will be just a description of the artifactoryUpload task.

artifactoryUpload

This task calls severall subtask. For each artifactoryUpload configuration there will be created a task with a sequence number. You can call call them all by using artifactoryUpload or each on their own:

gradle artifactoryUpload_0
gradle artifactoryUpload_n