Home » DevOps » Jenkins HOW-TO: build a project from multiple (Git) repositories

About Rafal Borowiec

Software developer, Team Leader, Agile practitioner, occasional blogger, lecturer. Open Source enthusiast, quality oriented and open-minded.

Jenkins HOW-TO: build a project from multiple (Git) repositories

Recently I have been working on a project that has two main modules: Backend and Frontend. The Backend is a Spring Boot application and the Frontend is an AngularJS 1.3 application. While preparing the build we are using Grunt for building AngularJS code and Gradle for building the Spring Boot application. Grunt is creating a JAR file containing all resources and copies it to Spring Boot application. Then Gradle takes the JAR and adds it to the resulting WAR. Long story made short.

Both Backend and Frontend are different Git repositories, initially managed by different teams. Both needs to be checked to the same root folder, so the building process will properly run. In order to do the it on Jenkins, Multiple SCMs Plugin Jenkins plugin can be used. The plugin simplifies the configuration of such a build.

The Jenkins task is updating both repositories and then it exectues a shell shell script that does the work of assembling and deploying the application. The configuration of Multiple SCMs is really simple:

  • Install the plugin: Jenkins > Manage Jenkins > Manage Plugins
  • Create new task: Jenkins > New Item
  • Choose Multiple SCMs in Source Code Management section:

multiscm-1

  • Add 1 repository (I am using Git). Choose: Add SCM

multiscm-2

  • Enter repository details
  • Add additional behavior. Choose: Add and from dropdown menu select Check out to a sub-directory

multiscm-3

  • Provide the sub-directory name
  • Repeat steps 4 to 7 for the second (and other repositories)

Now you can configure other sections of the task, save it and enjoy your new build from multiple repositories.

multiscm-4

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design

 

and many more ....

 

Receive Java & Developer job alerts in your Area

I have read and agree to the terms & conditions

 

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Shane
Shane
6 years ago

Helpful info. Thanks!

chandresh Mishra
chandresh Mishra
5 years ago

I am having the similar project.I am trying to achieve the same using pipelines as multiple SCM plugins is deprecated now.
could you please help.