Upload a file to an already existing released version in Nexus


(Daniel Olausson) #1

In our project we use uploadArchives to upload our artifacts to Nexus. This is working fine. Now after been doing this for a while want to introduce migration paths. To implement this we decided it would be a good idea to upload an upgrade script to Nexus for the version this script can upgrade to.

I’ve gotten it to work and the script is uploaded… however, it also tries to upload the pom file. But this is not allowed since this is a released version and i get 400 Bad Request error back.

Is there a way of just uploading a single file from gradle?
If not, would it be possible to catch the exception that is thrown somehow?

Note: this file is not generated by the build process.
The alternative would be to write a separate script to do the upload but then I would lose all the nice things in gradle, like repository handling with credentials etc.

Any suggestions? :slight_smile: