简体   繁体   English

将发布版本参数传递给Maven中的下游作业

[英]Pass release version parameter to downstream jobs in Maven

I'm a Maven noob currently working with Maven/Jenkins to perform some downstream jobs on the back of a release task and my team has hit a problem. 我是Maven noob,目前正在与Maven / Jenkins合作,在发布任务的后面执行一些下游工作,我的团队遇到了问题。

What we are trying to achieve is to pass in the version tag into the downstream jobs once the main build has been executed. 我们试图实现的是在主要构建执行后将版本标记传递到下游作业。 We had been trying to achieve this using the M2 plugin, but it appears to execute in a Build->Downstream Jobs->Release cycle, and we need to have a Build->Release->Downstream Jobs pattern. 我们一直试图使用M2插件实现这一目标,但它似乎在Build-> Downstream Jobs-> Release周期中执行,我们需要一个Build-> Release-> Downstream Jobs模式。

We therefore decided to create a separate job using the build step to perform the release a as a Goal. 因此,我们决定使用构建步骤创建一个单独的作业来执行作为目标的发布。 Here's the directives we are using to achieve this: 以下是我们用于实现此目的的指令:

-Pdmt -Dresume=false release:clean release:prepare release:perform -DautoVersionSubmodules

A consequence of abandoning the M2 plugin for this job has been that the prompt requesting the version number is no longer appearing. 放弃这个作业的M2插件的结果是,请求版本号的提示不再出现。 Subsequently, we've been trying to achieve this via the Post-build Actions, and passing in pre-defined parameters. 随后,我们一直在尝试通过Post-build Actions实现这一点,并传递预定义的参数。 The issue for us here is knowing how to pass in a dynamic parameter based on the previously executed job. 这里的问题是知道如何根据以前执行的作业传递动态参数。

An alternative angle we were looking at was specifying a properties file that the main job could tokenize prior to it's usage in the downstream jobs. 我们正在考虑的另一个角度是指定一个属性文件,主要作业可以在下游作业中使用之前进行标记。

Does anyone have any advice on how we might achieve this workflow, or if it's even possible? 有没有人对我们如何实现这个工作流程有任何建议,或者甚至可能?

OK, JFTR it looks like it's outside of the scope of the maven release plugin: 好的,JFTR看起来它超出了maven发布插件的范围

To answer the question I had to enumerate some of the assumptions made by the Release plugin. 要回答这个问题,我必须列举一下Release插件所做的一些假设。 I can tell you about these baseline assumptions and you can decide whether or not > something like the Maven Release plugin is appropriate for you. 我可以告诉你这些基线假设,你可以决定是否适合你的Maven Release插件。

What are these assumptions? 这些假设是什么?

Your codebase is going to be versioned and released as a “unit”. 您的代码库将被版本化并作为“单元”发布。 What does this mean? 这是什么意思? This means that you are going to be releasing an entire project at once with all of its submodules. 这意味着您将使用其所有子模块立即发布整个项目。 [sic] In Github it means that the Maven Release plugin is going to operate on an entire repository. [原文如此]在Github中,这意味着Maven Release插件将在整个存储库上运行。

The complex relationship of the repositories, releases and resultant artifacts prevent us from automating the task in the manner described in the question 存储库,版本和结果工件的复杂关系使我们无法以问题中描述的方式自动执行任务

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM