简体   繁体   English

如何在詹金斯管道中使用Artifactory Maven Build

[英]How to use Artifactory Maven Build in Jenkins Pipeline

i am trying to publish my build artifacts via artifactory maven to my artifactory server. 我正在尝试通过工件Maven将我的构建工件发布到我的工件服务器。

stage("${buildType} publish to Artifactory") {
        def server = Artifactory.server 'artifactory'
        def rtMaven = Artifactory.newMavenBuild()
        rtMaven.resolver server: server, releaseRepo: 'libs-release', snapshotRepo: 'libs-snapshot'
        rtMaven.deployer server: server, releaseRepo: 'libs-release-local', snapshotRepo: 'libs-release-local-SNAPSHOT'
        rtMaven.tool = 'maven tool name'
        def buildInfo = rtMaven.run pom: 'pom.xml', goals: 'clean package -Dskip.unit.tests=true -Dskip.integration.tests=true'
        server.publishBuildInfo buildInfo
    }

But the Job fails with 但是工作失败了

ERROR: Couldn't find Maven executable.

i tried to match the "maven tool name" with the name of maven in my jenkins tools, but it still doesn't work 我尝试将“ maven工具名称”与我的詹金斯工具中的maven名称进行匹配,但仍然无法正常工作

Any help appriciated 任何帮助

It seems that you "copy paste" the example without changing the variables. 似乎您在不更改变量的情况下“复制粘贴”了该示例。 In order for it to work you will need to verify the following: 为了使其正常工作,您需要验证以下内容:

  1. You will need to check what is the name of the Artifactory instance in the Jenkins system configuration page. 您将需要在Jenkins系统配置页面中检查Artifactory实例的名称。 The name is something that you gave it once configured Artifactory in Jenkins. 该名称是您在Jenkins中配置好Artifactory后为其赋予的名称。

    This will be the value under 'Server ID'. 这将是“服务器ID”下的值。 This value should be placed instead the 'Artifactory' in: 该值应放在“ Artifactory”中,而不是:

    def server = Artifactory.server 'artifactory'

  2. The rtMaven.tool = 'maven tool name' should also be replaced with the name you entered on the "Global Tool Configuration" for the Maven version you installed. rtMaven.tool = 'maven tool name'也应替换为您在“全局工具配置”中为安装的Maven版本输入的名称。

Once doing the above this should work. 完成上述操作后,此方法应该起作用。

It seems that you are using the correct maven tool name but not the correct Server ID of your artifactory. 看来您使用的是正确的maven tool name而不是工件的正确的Server ID

If you are not sure about the artifactory serverID , you may alternatively specify the artifactory using artifactory server address . 如果不确定artifactory serverID ,则可以使用artifactory server address指定工件。

  def server = Artifactory.newServer url: 'YOUR_ARTIFACTORY_URL', username: 'ARTIFACTORY_USERNAME', password: 'ARTIFACTORY_PASSWORD'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Maven,Jenkins Pipeline和Artifactory? - How to use Maven, Jenkins Pipeline and Artifactory? 在 jenkins 管道中集成 maven、artifactory 的问题 - Issue in integrating maven, artifactory in jenkins pipeline 如何从 jenkins 上传 maven 包并将信息构建到工件 - How to upload maven packages and build info to artifactory from jenkins 从詹金斯将Maven版本发布到Artifactory - Publish Maven build to Artifactory from Jenkins 使用 Jenkins、Artifactory、Maven 自定义构建标记 - Custom build tagging with Jenkins, Artifactory, Maven 包含计划文件的Jenkins Maven构建推送到工件 - Jenkins Maven build with plan files push to artifactory 使用Maven,Jenkins和Artifactory构建一次即可部署到任何地方 - Build Once, Deploy Anywhere, with Maven, Jenkins, and Artifactory 仅从 Maven Artifactory Repository 获取依赖项并在 Jenkins 声明式管道语法中运行 Maven 构建的简单方法是什么? - What is a simple way to only grab dependancies from a Maven Artifactory Repository and run a Maven build in Jenkins Declarative Pipeline Syntax? 将 jenkins 人工构建后步骤转换为流水线阶段 - convert a jenkins artifactory post build step into a pipeline stage 如何在 Eclipse 中使用 Artifactory maven - How to use Artifactory maven with Eclipse
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM