Maven并发构建在CI服务器上 [英] Maven concurrent builds on CI server

查看:142
本文介绍了Maven并发构建在CI服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为我有一个有趣的案例.我们正在使用Maven,并且由于我们必须支持产品的多个版本,所以有时我们会使用1.x和2.x构建结构.当1.x和2.x并行构建时,有时我们会看到

I have an interesting case, in my opinion. We are using maven, and being that we have to support multiple versions of our product we sometimes have a 1.x and 2.x build structure going on. When both 1.x and 2.x are built in parallel, sometimes we see

安装工件的元数据时出错:安装元数据时出错:更新组存储库元数据时出错

Error installing artifact's metadata: Error installing metadata: Error updating group repository metadata

据我所知,本地用户存储库中的maven-metadata-local.xml(对于工件,不是工件的版本)正在由另一个maven进程同时写入.有没有一种方法可以让maven并行构建这两者,但是要等待文件上的写锁对其进行更新?

From what I can tell, the maven-metadata-local.xml in the local user's repo (for the artifact, not the version of the artifact) is being written to at the same time by another maven process. Is there a way to allow maven to build both of these in parallel, but wait for a write lock on the file to update it?

推荐答案

听起来您正在对所有构建作业使用相同的本地存储库,而这些构建存储将无法正常工作. Jenkins/Hudson/CI中的要点是对每个构建作业都使用本地Maven存储库.您需要使用本地Maven存储库在Jenkins中进行配置,以避免这种情况.

That sounds that you are using the same local repository for all your build jobs which will not work as you already know. The point in Jenkins/Hudson/CI is to use a local maven repository for every build job. You need to configure in Jenkins using a local maven repository to avoid such situations.

您还可以安装并发安全本地存储库访问 maven插件,将允许您使用相同的本地存储库. (如果您正在动态配置代理,则很有用)

You could also install the Concurrent Safe Local Repository Access maven plugins which will allow you to use the same local repository. (Useful if you are dynamically provisioning the agents)

这篇关于Maven并发构建在CI服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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