Reputation: 3
Deploy programatically created KIE-Drools-Artifact to Maven repository has come closest to what I'm trying to do.
I have artifactory set up as a remote repository for a project, and what I want to do is deploy snapshot releases to the libs-shapshot-local repository from one project so that they can be accessed via others.
As for my code, I'm working with Drools/java and I am able to create a JAR file and deploy it to the local .m2 repository from inside the program(thanks to the above question), I'm able to upload the JAR to artifactory via the maven command line, but for some reason I've been unable to get the JAR into artifactory via the java code.
I've looked through this site and a couple others, but can't quite seem to find the right reference material. I've used the following for reference: How to deploy JAR to Maven remote repository http://blog.chintoju.com/2012/12/deploy-to-artifactory-remote-repository-using-maven.html
Thanks in advance!
Upvotes: 0
Views: 2805
Reputation: 20386
Artifactory has an open source Java client you can use for this.
Here is a simple deployment example:
InputStream inputStream = new FileInputStream("myfile.ext");
Artifactory artifactory = ArtifactoryClient.create("http://localhost:8081/artifactory", "username", "password");
File deployed = artifactory.repository("libs-shapshot-local").upload("path/to/deploy", inputStream).doUpload();
You can download the latest version of the client from Bintray or simply point your Maven build at http://jcenter.bintray.com
Upvotes: 3