Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute package for one submodule only on Jenkins?

Tags:

jenkins

sbt

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

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.

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).

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.

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

like image 257
Alebon Avatar asked Aug 06 '13 09:08

Alebon


1 Answers

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.

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

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")

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

like image 183
Jacek Laskowski Avatar answered Oct 31 '22 11:10

Jacek Laskowski