12

We have a ProjectB (only main, not tests) depend on ProjectA. ProjectA's test (not main) depends on ProjectB. We have maven produce two separate artifacts (main and test jars) for each project. So there is really no circular dependency here but maven complains about circular dependency. I am wondering if there there is a way to tell in maven that this is really not a circular dependency.

In ProjectA we have dependency section of ProjectB with "test" scope since only ProjectA tests depend on ProjectB.

ppeddi
  • 197
  • 1
  • 12

1 Answers1

9

Maven builds modules as a whole, so you can't have :

Building Project A (main)
Building Project B (main)
Building Project A (test)
Building Project B (test)

You can either group your code in one project or create a third project that will have all common code for projects A and B.

Guillaume Darmont
  • 5,002
  • 1
  • 23
  • 35
  • 1
    Hi Guillaume,Thanks for the reply. That is what we are doing now but I was hoping to avoid it by configuring maven since there is no circular dependency on jar in my case. I could not find a way to configure maven so we decided to refactor. – ppeddi Jun 06 '13 at 20:08