I have the following project hierarchy:

parent
-pom.xml
-domain
--pom.xml
-domain-builder
--pom.xml


The domain project contains (surprise) all of my domain objects:
  Account
  Person
  User
  etc.

The domain-builder project represents the "Test Data Builder Pattern"
(http://nat.truemesh.com/archives/000714.html) and contains things like:

AccountBuilder
PersonBuilder
UserBuilder

All of which depend on domain.

We use the domain builders in order to simplify testing in some of our
higher layers.  We do not include it in any packaged production code.  So
essentially:

domain-builder depends on domain (compile)
and
domain depends on nothing

and domain-builder is used like:

Account account = new AccountBuilder().allDummiedUp().withName("Leo").build

One of our developers asked me if it would be possible to use the
domain-builder packages in unit tests for domain in order to avoid having to
create test data via the .allDummiedUp methods.  I can kinda see the value
there, so I said I'd look into it.  Unfortunately it seems to introduce a
circular dependency:

domain-builder depends on domain (compile)
and
domain depends on domain-builder (test)

One solution might be to include the packages from domain-builder in the
domain project, but I don't want to package those classes in the final
domain JAR.

Has anyone else worked on this issue?  What would you recommend?

Thanks!


-- 
View this message in context: 
http://www.nabble.com/Advice-on-Resolving-Maven-Circular-Dependency-tp25929510p25929510.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to