Gradle - multiple project and git repositories

build, git, gradle, spring

Solution

ad 1) You have some choices:

- Use a single Git repo.

- Use multiple Git repos and exchange artifacts via a binary repository (e.g. Artifactory), with artifacts being produced on a regular basis by CI jobs.

- Use something like Github submodules to create a "virtual" overall Git repo (wouldn't recommend this one).

ad 2) Gradle doesn't really care how many Git repos the build is comprised of, as long as everything that `settings.gradle` points to (at least all build scripts) exists on disk when the build starts. Of course it may be inconvenient for developers (and CI admins) to juggle multiple Git repositories and put them in the right (relative) locations.

ad 3) Yes.

Problem

We have 3 projects and a 4th one that is shared among them. A multiple project in gradle requires one to create a wrapper project and include all the sub projects in it. Each of our sub projects are being worked on by different team members and we use git as an svn. Our concern before going into gradle is the fact that we will only have 1 git repository that consists of the wrapper project with all sub projects instead of 4 different repos, each for each sub project. 1) Are we missing something? 2) Is it possible to create 4 repos on a multi project? 3) One of our requirements is to deploy a single war (for example only webapp #1 out of the 4)--does using the multi project template make it possible?

Original source