0

Let's say I have a Gradle Multi Project with 3 subprojects, 2 Spring Boot projects (auth and profile) and 1 Library project (commons).

The 2 Spring Boot projects include a dependency on the Library project: implementation project(":commons")

Actually, to run the 2 Spring Boot projects, I have to run this from the parent project:

gradlew auth:bootRun
gradlew profile:bootRun

If I run gradlew bootRun only, from each Spring Boot subproject, I get the Error like the :commons Library project is not found in the root project, which makes sense, because the :commons project is included only in the parent's settings.gradle file.

I have to push each Spring Boot subproject individually to Heroku.

How should I manage ?

acmoune
  • 2,981
  • 3
  • 24
  • 41

1 Answers1

0

I finally got it, just add this in each subproject's settings.gradle file, then build:

include ":commons"
project(':commons').projectDir = new File('../commons')
acmoune
  • 2,981
  • 3
  • 24
  • 41
  • 1
    You shouldn't have a `settings.gradle` in each sub-project in the first place. If you do, it is no longer a multi-projet but rather completely separate, unrelated projects. And if this is on purpose because you really don't want to structure it as a multi-project for some reason, you should look into [composite builds](https://docs.gradle.org/current/userguide/composite_builds.html). – Bjørn Vester Nov 18 '20 at 12:30
  • Ok, that is probably why I still have a problem with deployment. I was able to run the app locally, but when I push it to Heroku, I have the same error, the project `:commons` is not resolved. Please can you check this question: https://stackoverflow.com/questions/64891154/how-to-deploy-on-heroku-a-gradle-spring-boot-app-with-dependency-on-a-local-lib – acmoune Nov 18 '20 at 12:47