0
votes

i want to upload my custom gradle wrapper to artifactory. I tried:

  1. standard upload task from gradle 'base' plugin
  2. artifactory gradle plugin

I always have some layout like /group/name/revision/[name]-[revision].zip What i need is simple repo/name-revision.zip, like in gradle-distribution repository: https://services.gradle.org/distributions

I am trying to upload zip into gradle-local pregenerated artifactory repo with 'Gradle' layout

I read about ivy layouts etc, but it all seems over complicated for such simple task.

Any advice?

1
Have you thought about using a FTP server ? - Bipi
It's just completely ok to stick with artifactory here. It's enterprise standard for artifact distribution in company, and we have no need to add additional entities in this scheme. - Dmitriy Voronin

1 Answers

0
votes

Using gradle-3.1 this works for me:

gradle.properties

artifactory = http://yourserver/artifactory/reponame
artifactoryUser = username
artifactoryPassword = the-encryped-password

build.gradle

apply plugin: 'maven'
apply plugin: 'distribution'

group = 'foo.bar'
version = '0.5-SNAPSHOT'

// not needed since we have standard layout src/main/dist
// distributions { main { contents { from { ... } } } }

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: artifactory) {
                authentication(userName: artifactoryUser, password: artifactoryPassword)
            }
            snapshotRepository(url: artifactory) {
                authentication(userName: artifactoryUser, password: artifactoryPassword)
            }
        }
    }
}

$> tree src
src
└── main
    └── dist
        ├── bla.txt
        └── blub.txt

$> ./gradlew uploadArchives
:distTar
:distZip
:uploadArchives

BUILD SUCCESSFUL

Total time: 1.332 secs

The zip can then be found in artifactory