<p>Build tools like <a href="/questions/tagged/maven" class="post-tag" title="show questions tagged &#39;maven&#39;" rel="tag">maven</a> or <a href="/questions/tagged/gradle" class="post-tag" title="show questions tagged &#39;gradle&#39;" rel="tag">gradle</a> could benefit you greatly here. It would do exactly what you have in mind as long as you have child project definition (with a <code>build.gradle</code> in gradle or <code>pom.xml</code> in maven).</p>

<p>I would not recommend the script as it would mean you have to maintain and tweak it in the future. Instead, investing in build tools can give you great ROI as they do much more than just build.</p>

<p>At the end if you cannot integrate a build tool, go for the script. It is a good idea also.</p>

CC BY-SA 3.0
2017-12-01T06:42:25.490Z
Could you give an example how a cradle file that is to build all projects when this job is triggered?
030
CC BY-SA 3.0
2017-12-02T17:13:38.797Z
What are you trying to build? Java? C++? Multi language? I proposed gradle as an example because of its generality. It is more of a groovy task manager that gives you incredible flexibility on the way you want to build your projects then enforcing you a specific pattern. Here is a link on the multi-project concept: https://docs.gradle.org/current/userguide/intro_multi_project_builds.html
gmolaire
CC BY-SA 3.0
2017-12-01T00:05:25.170Z
2017-12-01T00:15:59.903Z
2017-12-01T00:15:59.903Z
gmolaire
<p>We have a monorepo that consists of multiple projects that contain a build file. How to ensure that all these projects will be built when the job is triggered?</p>

<p>One solution I am thinking about is creating a shell script that detects whether the folders contains a build script, add the name to a set, iterate on this set and trigger a build for all of the projects. I wonder whether this is a good approach, but it feels cumbersome.</p>

<jenkins><monorepo><gradle>
How to build all projects in a monorepo by starting a build in Jenkins?
030
# How to build all projects in a monorepo by starting a build in Jenkins?

(Asked by: username_0 on 2017-11-30)

We have a monorepo that consists of multiple projects that contain a build file. How to ensure that all these projects will be built when the job is triggered?

One solution I am thinking about is creating a shell script that detects whether the folders contains a build script, add the name to a set, iterate on this set and trigger a build for all of the projects. I wonder whether this is a good approach, but it feels cumbersome.

**Tags:** jenkins, monorepo, gradle


---

## 1 answers

### Answer by username_1 on 2017-12-01. Score: 1 | Accepted answer

Build tools like [maven](/questions/tagged/maven "show questions tagged 'maven'") or [gradle](/questions/tagged/gradle "show questions tagged 'gradle'") could benefit you greatly here. It would do exactly what you have in mind as long as you have child project definition (with a `build.gradle` in gradle or `pom.xml` in maven).

I would not recommend the script as it would mean you have to maintain and tweak it in the future. Instead, investing in build tools can give you great ROI as they do much more than just build.

At the end if you cannot integrate a build tool, go for the script. It is a good idea also.

> **Comments:**
> **username_0**: Could you give an example how a cradle file that is to build all projects when this job is triggered?  
> **username_1**: What are you trying to build? Java? C++? Multi language? I proposed gradle as an example because of its generality. It is more of a groovy task manager that gives you incredible flexibility on the way you want to build your projects then enforcing you a specific pattern. Here is a link on the multi-project concept: https://docs.gradle.org/current/userguide/intro_multi_project_builds.html  

---

