kal*_*ada 0 java build maven jenkins devops
我们正在开发一个遗留项目,第一个任务是设置一个DevOps.重要的是我们对这个领域很新.
我们计划最初使用jenkins和sonarqube.让我从这些要求开始.
例如:该项目被细分为5个多模块maven项目,比如A,B,C,D和E.
1. A and C are completely independent and can be easly built
2. B depends on the artifact generated by A (jar) and has multiple maven profiles (say tomcat and websphere, it is a webservice module)
3. D depends on the artifact generated by C
4. E depends on A, B and D and has multiple maven profiles (say tomcat and websphere, it is a web project)
Run Code Online (Sandbox Code Playgroud)
基于jenkins文档来处理这种情况,我们正在考虑使用"参数化构建插件"和"扩展选择参数插件"参数化构建,借助这些插件,我们可以参数化配置文件名称.但在每次构建之前,构建器等待配置文件参数.
所以我们仍在寻找一个很好的解决方案
1. keep the dependency between projects an built the whole projects if there is any change in SCM (SVN). For that we are used "Build whenever a SNAPSHOT dependency is built" and "SCM polling option". Unfortunately this option seems not working in our case (we have given an interval of 5 min for scm polling but no build is happening based on test commits)
2. Even though we are able to parameterize the profile, this seems as a manual step (is there an option to automate this part too, ie. build with tomcat profile and websphere profile should happen sequentially).
Run Code Online (Sandbox Code Playgroud)
我们正在努力寻找满足所有这些核心要求的解决方案.任何指针都将非常感激.
谢谢,圣
我的maven知识是有限的,但是因为你还没有得到任何回应,所以我试着给出一些一般的建议.
詹金斯通常有多种方法可以实现某些目标,每种方法都有其优点和缺点.选择最合适的解决方案取决于具体要求和您的环境/设置.
但是,你首先需要一些正常工作,然后你可以改进它.
通过以下方式获得快速结果
- 配置您的subversion repo(可以多个)以检出您的工作区
- 启用轮询SCM触发器
- 通过Execute shell构建步骤构建模块/项目.(通过
Exit 1
在Execute shell
构建步骤中使用,可以将失败的构建交给作业结果.)
但请记住,这将阻止基于每个项目/模块的高级功能,例如向开发人员发送邮件通知.或指标趋势,如警告或静态代码分析.
以下解决方案更容易在该方向上扩展.
- 使用构建步骤触发/调用构建在其他项目上构建
A
,存档所需的工件- 使用Build步骤触发/调用构建在其他项目上,使用一些参数
tomcat
构建B tomcat
版本,使用Copy Artifact Plugin从jar复制A
- ...
- 使用构建步骤触发/调用构建在其他项目上,并使用一些参数
tomcat
构建E tomcat
版本.使用复制工件插件复制所有需要的工件,如果需要工件即B tomcat
版本,可以在那里指定参数
在此设置中,监视svn是一个问题,因为如果从轮询SCM触发它,它将在您的包装工作区中将其签出,而您实际上不需要在那里签出,而是在您的构建作业中.
可能的解决方案:在包装器作业和构建作业之间共享工作空间,因此构建作业中的重复签出将找到已在正确修订中的文件.但是你需要+来确保下游作业在同一台机器上执行(有插件可以这样做)
或者更优雅:在你的svn上使用post-commit钩子(参见这里的 post-comit hook部分)来通知jenkins更改.
编辑:对于未来,它值得研究Pipeline插件及其更复杂构建的文档,这是即将推出的jenkins版本2.0的引擎,请参阅此处.
归档时间: |
|
查看次数: |
3383 次 |
最近记录: |