Recommendations for creating a Maven project structure - multiple modules or multiple projects?

Consider the following example of an enterprise application hierarchy:

  • project-services → POJO Service Level
  • project-web → Web application, dependent on “service projects” deployed as WAR
  • project-web-services → Web services dependent on “project-services”, deployed as a separate WAR, not currently viewed over the Internet.
  • project-standalone → Cron Jobs, depends on "project-services"

What would be the right approach for organizing this in Maven. Should I create a multi-module maven project? if "project-services" is a Maven module, can it be shared with the other three projects, each of which is an independent deployable module?

In my previous projects, I just created 4 different Maven projects and never needed anything else.

Want to check if there is a better way than what I did before.

+5
source share
4 answers

You can really do any approach. If this is really one big project that you always want to create and release at the same time, a multi-module project is suitable. You would set it like this:

pom project (top level project that would define all of the modules)
  jar project (project-services)
  war project (project-web)
  war project (project-web-services)
  project-standalone (wasn't sure if this was a jar, or just some scripts, etc)

So, you just create and release the root project, and it will take care of all the additional modules for you. They can have dependencies on each other (just be careful with circular dependencies). And you will almost certainly want to go.

- . . , , , .

, , , , , , , . maven , , , , , .

+2

, (15 35 ). . , , .

, :

( ), . , - . eclipse, , .

+1

, , .

POM- , .

0

, .

What I often recommend is to consider the module life cycle. For example: if you released a package module much more often than a service level, it might make sense to split it into parts. Therefore, you do not need to release (deploy) material that does not have any changes. Because the package usually does not deploy in the same way as .war files. But it depends on the life cycle of the service + package modules.

In most cases, movement side by side. So +1 for "one for all"

0
source

All Articles