Multi Project
Adding other projects as sub modules of our Spring Boot project requires editing the build.gradle and settings.gradle files.
settings.gradle¶
To include a project from the same workspace folder, add the following to the settings.gradle file:
includeFlat 'NameofProjectToInclude'
In our setup, the Spring Boot project includes the JPA project.
build.gradle¶
Now that Gradle knows about the project you are trying to include, we need to compile the project and include it as a dependency.
dependencies {
implementation project(':NameofProjectToInclude')
// ...
}
Drill¶
- Include
JPAVideoStoreas a sub project ofBootMVCVideoStore.Open BootMVCVideoStore/settings.gradle
- MAKE SURE YOU ARE IN THE
settings.gradleOF BootMVCVideoStore.- add
includeFlat 'JPAVideoStore':* This tells MVCVideoStore that it has a sub project named JPAVideoStore 1. Save and close BootMVCVideoStore/settings.gradle. 1. Open BootMVCVideoStore/build.gradle * MAKE SURE YOU ARE IN THE// settings.gradle rootProject.name = 'BootMVCVideoStore' includeFlat 'JPAVideoStore'build.gradleOF BootMVCVideoStore. * Add the dependency to compile theJPAVideoStoreproject.1. Save and close BootMVCVideoStore/build.gradle. 1. Do a Gradle refresh of BootMVCVideoStore.dependencies { implementation project(':JPAVideoStore') // ... }