Search code examples
mavencircular-dependencycyclic-dependency

Cyclic dependency in Maven, chickens and eggs


I have a project called 'talktome', with no runtime dependencies.

Also I have project 'talktome-tools', which depends on 'talktome'.

No problems, until I realize that the unit-tests in 'talktome' depends on 'talktome-tools'.

What solutions are there?


Solution

  • If talktome is a general project where other (e.g talktome-tools) depends on, it should not be depend on the more specific projects. Then, it would be wise to get rid of dependency from talktome to talktome-tools.

    Otherwise, you would create a more higher level project (e.g parent) and put necessary interfaces, classes that can be used by both talktome and talktome-tools to the new project.