如何在 jenkins 上跨多个项目构建作业管理通用 ant 构建脚本? [英] How to manage a common ant build script across multiple project build jobs on jenkins?

查看:27
本文介绍了如何在 jenkins 上跨多个项目构建作业管理通用 ant 构建脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组来自不同 git 存储库的 java 项目,我想用 Jenkins 构建它们.

I have a set of java projects coming from different git repositories which I want to be built with Jenkins.

它们都共享相同的 ant 构建脚本,该脚本通过 ant 导入机制使用项目特定的配置部分(例如编译类路径).

All of them share the same ant build script, which employs project specific configuration parts (e.g. compile class path) via ant import mechanism.

目前我手动进行此共享,但是在更改公共部分时很容易出错.

At the moment I do this sharing manually, but this is very error prone on changes to the common part.

所以我的问题是:在 jenkins 服务器上跨多个构建作业管理共享 ant 构建脚本的好方法是什么?

So my question is: What is a good approach to manage a shared ant build script across multiple build jobs on a jenkins server?

推荐答案

一些想法...

  1. 将 Ant 脚本存储在您的各个项目可以从中提取的工件存储库中,就像任何其他依赖项一样.
  2. 创建一个包含构建脚本的父 Git 项目.在您的父项目中,将每个单独的子项目作为 Git 子模块.您可能需要对脚本进行一些小的修改,以便参数化构建脚本中的子项目引用.
  1. Store the Ant script in an artifact repository that your individual projects can pull from, like any other dependency.
  2. Create a parent Git project that contains the build script. In your parent project, pull down each individual sub-project as a Git submodule. You would probably need to make some minor modification to your script in order to parameterize the sub-project references in the build script.

这个答案不是特定于 Jenkins 的,应该可以移植到其他构建服务器.

This answer is not specific to Jenkins and should be portable to other build servers.

这篇关于如何在 jenkins 上跨多个项目构建作业管理通用 ant 构建脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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