Say we have a Java project with subprojects like
- persistence
- businessA
- businessB
- web
where everything depends on persistence
and web
depends on both business
subprojects.
We use git and feature branches.
We use jenkins with pipelines and jenkins' multibranch feature to build and test those feature branches every time there is a push to the central repo.
The problem is that the codebase is rather large and running tests needs 1+ hour overall. It would be great if the the pipeline would only execute tests of the subprojects that changed (and its dependents) in respect to develop
branch. Gradle can do incremental builds but when jenkins creates a workspace for a feature branch gradle needs to do a full build. (e.g. a new feature branch changes code in web
subproject only and there is no need to run all tests on the other 3 subprojects)
So how do we avoid a full build (especially running all tests) on a new feature branch in a Jenkins multibranch pipeline?