以编程方式将项目JAR部署到工件 [英] Deploying project JAR to artifactory programmatically

查看:119
本文介绍了以编程方式将项目JAR部署到工件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将以编程方式创建的KIE-Drools-Artifact部署到Maven存储库与我想做的最接近.

我将工件设置为项目的远程存储库,我要做的是将快照发行版从一个项目部署到libs-shapshot-local存储库,以便可以通过其他项目访问它们.

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.

对于我的代码,我正在使用Drools/java,并且能够创建一个JAR文件并将其从程序内部部署到本地.m2存储库中(由于上述问题),我能够通过maven命令行将JAR上传到工件上,但是由于某种原因,我一直无法通过Java代码将JAR插入工件上.

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.

我已经浏览了该站点和其他几个站点,但是似乎找不到合适的参考资料.我已将以下内容用作参考: 如何将JAR部署到Maven远程存储库 http://blog.chintoju. com/2012/12/deploy-to-artifactory-remote-repository-using-maven.html

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

提前谢谢!

推荐答案

Artifactory具有开放源代码 Java客户,您可以使用它.
这是一个简单的部署示例:

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();

您可以从 Bintray 下载客户端的最新版本.或者只是将您的Maven构建指向 http://jcenter.bintray.com

You can download the latest version of the client from Bintray or simply point your Maven build at http://jcenter.bintray.com

这篇关于以编程方式将项目JAR部署到工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆