Reputation: 1697
There are currently 3 projects/git repos set up with gradle:
Dependencies:
app -> backend
client -> backend
Since app
and client
don't depend on everything in backend
like they do not depend on spring etc. but on some model classes, I need to find a good solution for building the project.
I thought of ...
backend
artifactsrc/main/java
and src/api/java
api
source folder compiled as a jar artifactapp
and client
backend/src/api/java
to app
and client
api
projectapp -> api
client -> api
backend -> api
The first and second solution does not need to have a fourth git repo and I think it's not a bad idea to have the api
component in the backend
, but in the context of gradle a project dependency like in 3., would be more transparent I think.
Any best practices?
Thank you for helping !
Upvotes: 2
Views: 348
Reputation: 6913
Best practice is option number 3 (create a new api
project).
Side note: You don't need to make a separate repo for the api project, you could keep it alongside the backend project if you wanted.
Edit: Adding Repo Layout
If you want to have the api along side the server, you would want this layout. Then reference the API like project(":backend:api")
.
├── app
│ └── build.gradle
├── backend
│ ├── api
│ │ └── build.gradle
│ └── server
│ └── build.gradle
├── build.gradle
├── client
│ └── build.gradle
└── settings.gradle
Upvotes: 1