0

Is it possible to just upload a file to an Artifactory repository with Gradle and without using the maven-publish plugin?

All I want to do is upload any file to a specific repository location. Here is the publishing snippet:

publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java
        }
        updatePlugins(MavenPublication) {
            group = 'pluginDescriptor'
            version = ''
            artifact file('README.txt')
        }
    }
}

All I want is that the updatePlugins entry uploads the README.txt to the relative repository path /pluginDescriptor.

But README.txt gets uploaded as pluginDescriptor/nip/nip-.txt where nip is the project name.

How can I give a dedicated name without group, artifactID and version?

All examples I could find use the maven-publish plugin which uploades the files according to group, artifactID and version.

Any ideas on how to achieve this?

EDIT: There is a direct possibility how the task can be achieved in an platform independen matter: artifactory-client-java

Juergen
  • 3,489
  • 6
  • 35
  • 59

1 Answers1

2

A simple curl command can do the trick

curl -k -u user:pass -T path/to/README.txt http://ip:port/artifactory/repo/group/artifactID/version/

Then, a Gradle version of this command can help you doing the job inside your build.gradle

ToYonos
  • 16,469
  • 2
  • 54
  • 70
  • That would require to install `curl` on each system. Actually, Gradle with its wrapper tries to eliminate system dependencies like this one. – Lukas Körfer Sep 11 '18 at 17:39
  • @koerfer: but I need to upload a file to a relative repo path. This should be a fairly simple and platform independent task. – Juergen Sep 11 '18 at 20:58