doniatio
doniatio

Reputation: 13

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?

Upvotes: 1

Views: 2371

Answers (2)

Kasun Gajasinghe
Kasun Gajasinghe

Reputation: 2776

You may move the tests to another maven module like talktome-tests that will do the integration testing. It makes sense especially it seems that talktome shouldn't depend on specific project like talktome-tools.

And, test dependencies like talktome-tools should be included with test scope.

Upvotes: 1

suat
suat

Reputation: 4289

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.

Upvotes: 3

Related Questions