Reputation: 235
I've got a multiproject with several Modules (Microservice Modules), this Modules have a same codebase etc. persistence layer. Which i would like to extract in a separate Module (Shared Module).
The structure looks like:
Main Pom
|- Microservice 1
| |- module 1
| |- module 2
|- Microservice 2
| |- module 1
| |- module 2
|- Microservice 3
| |- module 1
|- Shared Module
I know that i can add the "Shared Module" as a dependency to the "Microservice Modules", but than I can only build the hole project by building from the main pom.
But i want to build the Microservices Modules separately. Is it possible building the Shared Module before building only one Microservice Module.
Upvotes: 2
Views: 231
Reputation: 2968
You should add the shared module as dependency for others modules.
Then, add a <modules>
section (if not already exists) in main pom and list all modules.
Then, you can build only shared module from main pom by doing:
mvn install -pl :shared-module
Or you can build all modules by doing:
mvn install
Or you can build only module1 and theses dependencies (ie shared-module) by doing:
mvn install -pl :module1 -am
Or you can also list all projects you want to build manually:
mvn install -pl :shared-module,:module1
Upvotes: 1