在构建之前编辑文件(Edit file before build)

编程入门 行业动态 更新时间:2024-10-25 20:23:46
在构建之前编辑文件(Edit file before build)

我在Jenkins有一个部署网站的工作。 我希望这个工作用另一个版本的依赖项临时构建,以测试它是否有效。

要做到这一点,我有几个选择,

我创建了我的主项目的一个分支,并设置了一个新的jenkins工作 我搜索了一个maven插件,允许我在“buildtime”编辑依赖项 我搜索了一个jenkins插件,允许我在“buildtime”之前编辑pom.xml(或任何文件)。 (我在搜索失败后询问Stack Overflow)

对我而言,能够在Jenkins构建中执行某些替换而不必更改版本控制系统中的任何内容似乎相当不错。 一个maven插件也可能不错但是...它已经是一种xml-hell了所以我宁愿尽量保持pom.xml尽可能薄。 特别是对于这样的情况。

哪种方式更受欢迎? 是否有任何现有插件可以解决您可以推荐的此类问题?

I have a job in Jenkins that deploys a site. I'd like this job to temporary build with another version of a dependency to test if it works.

To do this I have a few choices,

I create a branch of my main project and setup a new jenkins job I search for a maven plugin that allow me to edit a dependency at "buildtime" I search for a jenkins plugin that allows me to edit the pom.xml (or any file) before "buildtime". (I ask on Stack Overflow after unsuccessful search)

To me it seems quite nice to be able to perform some substitution in the Jenkins build without having to change anything in the versioning system. A maven plugin might also be nice but... it is kind of xml-hell already so I'd rather try to keep the pom.xml as thin as possible. Especially for a case like this.

Which way is preferred? Are there any existing plugins that solve this kind of problem that you can recommend?

最满意答案

拥有自己的分支机构是一个好主意,因为您正在进行开发工作。 如果您正在处理的工作无效,您可以随时删除分支。 如果它确实有效,您始终可以将其合并回原始分支。

如果您使用正确的工具并遵循适当的原则,那么合并并不是什么大问题。

或者,您可以在<profile> <dependency>定义<dependency>并使用mvn clean ... package -PmyProfile触发配置文件。

我肯定会选择第一个选项,因为它更有意义,也更清洁。

Having your own branch would be a good idea, as you're doing development work. If what you're working on doesn't work out, you can always remove the branch. If it does work, you can always merge it back into the original branch.

Merging is not that much of a big deal, if you're using the right tools and follow the proper principals.

Alternatively, you can have the <dependency> defined in a <profile> and trigger the profile with mvn clean ... package -PmyProfile.

I would definitely go for the first option, as that makes more sense and is cleaner.

更多推荐

Jenkins,maven,xml,电脑培训,计算机培训,IT培训"/> <meta name="description

本文发布于:2023-07-22 12:21:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1219974.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:编辑   文件   Edit   file   build

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!