如何仅在Jenkins上为一个子模块执行包? [英] How to execute package for one submodule only on Jenkins?

查看:1144
本文介绍了如何仅在Jenkins上为一个子模块执行包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含4个模块的sbt项目:module-amodule-bmodule-cmodule-d.

I have a sbt project with 4 modules: module-a, module-b, module-c, module-d.

每个模块都可以打包为WAR.我想在Jenkins上建立一个部署,该部署将仅构建4个模块之一并将其部署到容器中.

Each module can be packaged as a WAR. I want to set up a deployment on Jenkins that would build only one of the 4 modules and deploy it to a container.

详细地说,我想拥有4个Jenkins作业-job-ajob-bjob-cjob-d,每个仅构建定义的模块(a至d).

In detail, I want to have 4 Jenkins jobs - job-a, job-b, job-c, job-d, each building only the defined module (a to d).

现在,我将clean update test package用作Jenkins sbt构建的命令,但这导致打包所有4个不必要的模块.

For now, I am using clean update test package as the command for the Jenkins sbt build, but this results in packaging all 4 modules that is not necessary.

我已经尝试过project -module-a clean update test package,但是没有运气.

I already tried project -module-a clean update test package but with no luck.

推荐答案

您可能还希望按以下方式执行项目范围的cleantest任务:

You may also like to execute project-scoped clean and test tasks as follows:

sbt module-a/clean module-a/test

对于以下命令适用于哪个项目,解决方案稍微短一些,而且更清楚.

The solution is slightly shorter and clearer as to what project the following commands apply to.

您不需要执行update任务,因为它由test隐式执行,如inspect tree test中所述.

You don't need to execute update task since it's implicitly executed by test as described in inspect tree test.

有一种方法可以使它更干净.在build.sbt中使用以下内容:

There's a way to make it cleaner with an alias. Use the following in the build.sbt:

addCommandAlias("jenkinsJob4ModuleA", "; module-a/clean; module-a/test")

使用别名,执行jenkinsJob4ModuleA具有与上述解决方案相同的效果.

With the alias, execute jenkinsJob4ModuleA to have the same effect as the above solution.

这篇关于如何仅在Jenkins上为一个子模块执行包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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