Maven multi module project Cyclic Dependency Issue

Viewed 47

I have the following modules in my Maven multi module project:

**Parent module ,Child1 module

Both Child1 and Child2 are dependent on Common Module.So I have added Common module dependency on both pom files of Child1 and Child2.

But now I somehow need to add Child2 dependency on as well .Is there any way I can make a change to my structure so that it can support my requirement and don't lead to cyclic dependency problem.

1 Answers

You can:

  • Move classes from Child2 to Common.
  • Define another module Z to which you move common classes, and then let Child2 and Common declare a dependency on Z.
  • Merge Child2 and Common into one module.
Related