从Jenkins上传多个Gradle工件到Artifactory [英] Upload multiple Gradle artifacts to Artifactory from Jenkins

查看:516
本文介绍了从Jenkins上传多个Gradle工件到Artifactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的环境使用Gradle构建,Jenkins使用CI,Artifactory使用库。我使用Jenkins的Artifactory插件。



Jenkins成功构建了我的主jar文件并将其上传到Artifactory。构建脚本的第二个目标是在构建/分发下创建分发zip文件。詹金斯成功创建了zip文件,但我不知道如何告诉它将该工件上传到Artifactory。



这是我应该能够指定的东西在Jenkins Artifactory插件配置中,或者我应该在Gradle构建脚本中定义的东西?感谢您的任何指示。

解决方案

我假设您已在管理Jenkins 部分中正确配置了artifactory服务器;您的工作也被设置为 Freestyle Project



选择您的工作,然后点击配置。在构建环境中检查通用Artifactory集成。从下拉菜单中选择您的 Artifactory Server Target Repository ,如果需要,请选中覆盖默认部署者凭据。在已发布的工件中,输入要发布的zip文件的模式,例如, $ {WORKSPACE} / distr / *。zip (其中 WORKSPACE 是jenkins当前项目的工作区, distr / *。zip em>你的发行zip文件)。检查是否需要捕获和发布构建信息包含环境变量等保存您的工作。下次构建时,zip文件将被上传,并将在artifactory的 Builds 部分中提供。

My environment uses Gradle for builds, Jenkins for CI, and Artifactory for a repository. I use the Artifactory plugin for Jenkins.

Jenkins successfully builds my main jar file and uploads it to Artifactory. The build script has a second target for creating a distribution zip file under build/distributions. Jenkins creates the zip file successfully, but I don't know how to tell it to upload that artifact to Artifactory, too.

Is this something I should be able to specify in the Jenkins Artifactory plugin config, or something I should define in the Gradle build script? Thanks for any pointers.

解决方案

I assume you have configured artifactory server correctly in Manage Jenkins section; also your job is setup as a Freestyle Project.

Select your job and click Configure. Check Generic Artifactory Integration in Build Environment. Select your Artifactory Server and Target Repository from drop downs, check Override default deployer credentials if required. In Published Artifacts you enter the pattern for your zip file to be published, e.g. ${WORKSPACE}/distr/*.zip (where by WORKSPACE is jenkins current project's workspace and distr/*.zip your distribution zip file). Check if required Capture and publish build info, Include environment variables etc. Save your job. When you build it the next time, the zip file will be uploaded and will be available in the Builds section on artifactory.

这篇关于从Jenkins上传多个Gradle工件到Artifactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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