Maven – Why and when to create a multi-module Maven project

mavenmulti-moduleproject-organization

I have a general question about Maven's multi module project. When and why to go for it?

Best Answer

The answer of @Esko Luontola

Splitting the project into multiple modules is useful for example if the modules need to be deployed separately,..

could be misinterpreted. If you have modules which will be deployed separately, it's exactly the opposite. In such case, you should never create a multi-module build. This should be done via simple separate maven projects.

The idea of a multi-module build is if you have modules which belong together like an ear project which usually consists of several others like client, server, ejb, war, etc. This is usually handled via a multi-module build which means all modules have the same version number but can be accessed and used by other separately.