I would like to upload an artifact to Nexus from Java. Because the Java code is running in a Jira plugin I would like to avoid
- including external libraries like Aether, Maven Resolver or Rest client APIs
- calling external programs like Maven or Curl.
For downloading files, I used commons-io from apache which is already present if you use the Atlassian SDK. This works fine. But I am stuck in uploading. I think I need to construct a REST POST request like the following curl one
curl -v -F r=inubitdeployment -F hasPom=false -F e=jar -F g=com.test -F a=project -F v=1.0 -F p=jar -F file=@log4j.jar -u User:password http://ik-repository:8081/nexus/service/local/artifact/maven/content
but I do not know how to do this from Java.