简体   繁体   English

Maven / Jenkins - 项目和依赖项的自动发布

[英]Maven/Jenkins - Automatic releases of project and dependencies

I'm working in maven project with several dependencies at several levels and each time a release of primary project is performed we have to create a lot of secondary releases manually. 我正在maven项目中工作,在几个级别上有几个依赖项,每次执行主项目的发布时,我们必须手动创建大量的二级版本。 I will try to explain the situation. 我会试着解释一下情况。 My scenario is the following: 我的方案如下:

Project A 项目A.

  1. Dependency B 依赖性B.
    • Dependency E 依赖性E.
    • Dependency F 依赖性F.
      • Dependency G 依赖性G.
  2. Dependency C 依赖性C.
    • Dependency G 依赖性G.
      • Dependency H 依赖性H.
  3. Dependency D 依赖性D.

Each dependency is an independent maven project and it exists a lot of dependency levels inside projects. 每个依赖项都是一个独立的maven项目,它在项目中存在很多依赖项级别。 If you modify some code of dependency G and your intention is to generate Project A release you have to: 如果您修改某些依赖关系G代码并且您的目的是生成Project A版本,则必须:

  1. Generate release of project G 生成项目G的发布
  2. Update dependency G version on project F 更新项目F上的依赖关系G版本
  3. Generate release of project F 生成项目F的发布
  4. Update dependency F version on project B 更新项目B上的依赖关系F版本
  5. Generate release of project B 生成项目B的发布
  6. Update dependency B version on project A 更新项目A上的依赖关系B版本
  7. Generate release of project A 生成项目A的发布

My intention is to automate this process. 我的目的是自动化这个过程。 I didn't find any similar question after googling it for several days. 谷歌搜索几天后我没有发现任何类似的问题。

Can you think in some solution for automatizing the task of generating releases in cascade? 您是否可以在某种解决方案中考虑自动化级联生成版本的任务? I'm thinking in a solution based on maven and Jenkins tasks but it looks like very complex. 我正在考虑基于maven和Jenkins任务的解决方案,但它看起来非常复杂。

Maybe you can use a combination of Build Flow plugin and Maven Release plugin to release your Maven projects. 也许您可以结合使用Build Flow插件Maven Release插件来发布您的Maven项目。

The Build Flow plugin will help you to design your build sequence (and respects your project dependencies). Build Flow插件将帮助您设计构建序列(并尊重您的项目依赖性)。

It's just an idea, I didn't test this solution. 这只是一个想法,我没有测试这个解决方案。

In Jenkins you can use different repositories to download and make the build, in this case you will perform a release. 在Jenkins中,您可以使用不同的存储库来下载并进行构建,在这种情况下,您将执行发布。 Hope you are using maven-release-plugin . 希望你使用的是maven-release-plugin So, you can use this jenkins's feature to download all the projects you mentioned and create or download the pom.xml file from the repo which contains each project as a module (Just to achieve your goal). 因此,您可以使用此jenkins的功能下载您提到的所有项目,并从repo创建或下载pom.xml文件,其中包含每个项目作为模块(只是为了实现您的目标)。

Structure in jenkins's workspace should looks like this: jenkins工作空间中的结构应如下所示:

  • pom.xml 的pom.xml
  • moduleA pom.xml moduleA pom.xml
  • moduleB pom.xml moduleB pom.xml
  • moduleC pom.xml moduleC pom.xml

My advice is to group them in a repository if is needed. 我的建议是在需要时将它们分组到存储库中。

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

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