Question

I have a multi module maven project with these dependencies : module-gui -> module-business

Each module has its own specific domain object :
gui module => view domain objects
business module => business domain objects.

For some business logic I have to map view objects from gui module to business domain objects from business module into the business module !
It gives me trouble because it cause a maven circular dependency.
module-gui depends on module-business so I can't add a dependency on module-gui into module-business to have access on the gui domain objects.

I could move all domain objects into a common module to break the circle dependency but I think it's better to put objects in the right module (view objects into view module and business objects into business module) but maybe I'm totally wrong :).

Do you know if there is a good practice for this kind of problem ?

Was it helpful?

Solution

You should use Maven multi-module when you want to execute the same action, compile for example, on many projects.

If you want to compile all your application tiers in a Maven multi-module project you necessarily have to find a trade-off between module consistency and build automation.

So I think, in the given architecture, your solutions is good compromise: declaring compiling dependency, and avoiding the circular ones, lets you leverage the Maven reactor to sort compilation modules leaving you free from sorting them.

On the other hand you might revise the architecture decoupling view and business tier by using the controller tier to transform view domain objects into business domain objects (view --> business), and to transform business domain objects into view domain objects (view <-- business).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top