Hello all! We’re switching over to Gradle and reorganizing some code, and I was hoping to get some feedback on best practices.
We have a Jenkins CI server, and we’re aiming to reduce build times. Our project is primarily Java, with other components such as Grunt/Gulp Javascript builds and native projects.
Consider the following simple multi-project:
base-project/
|- widget-one/
|- widget-two/
|- container-app/
|- settings.gradle
Each sub-project would be its own git repository and have necessary build instructions. I would like each component to be separately buildable by Jenkins, which would then publish to our Maven repository. In the Jenkins context, it would have no knowldge of the multi-project.
However, on our local environments it can be expected each component would be under the ‘base-project’ directory, and inherit from settings.gradle, etc. In this environment, when I build ‘container-app’, which is dependent on the widgets, it would then build all dependencies as necessary.
I was thinking each component by default would publish to Maven, and in the development multi-project environment, it would override the repositories to MavenLocal(). Then, sub-projects could conditionally depend on other sub-projects if they exist, which would trigger builds on demand and publish to MavenLocal(). Then, since artifacts are updated and available in local maven cache, the sub-projects would pull down the recently-built artifacts without much build code duplication.
My question is, is this a sane configuration? Is there a more idiomatic way to accomplish what I’m working toward? My goal is that developers can pull down all the code and not worry about component artifacts being out of sync locally, while Jenkins builds remaining fast and atomic, decoupled from the large multi-project.
Also, as mentioned, some projects are not Java, but I don’t feel this is an issue conflicting with Maven or anything.
Again, I’m new to Gradle so I could be missing an essential idiom of some kind… thanks so much!