You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by leojhartiv <le...@gmail.com> on 2009/10/16 19:41:52 UTC

Advice on Resolving Maven Circular Dependency

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Advice on Resolving Maven Circular Dependency

Posted by leojhartiv <le...@gmail.com>.
I'm not sure I agree there.  I won't have any Asserts on a domain builder
class.  Only the domain classes.  



Kalle Korhonen-2 wrote:
> 
> I'd just put those tests in domain-builder module and call them
> integration tests. After all, they are testing the builder classes
> just as well as the domain classes.
> 
> Kalle
> 
> 
> On Fri, Oct 16, 2009 at 10:41 AM, leojhartiv <le...@gmail.com> wrote:
>>
>> 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: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Advice on Resolving Maven Circular Dependency

Posted by Kalle Korhonen <ka...@gmail.com>.
I'd just put those tests in domain-builder module and call them
integration tests. After all, they are testing the builder classes
just as well as the domain classes.

Kalle


On Fri, Oct 16, 2009 at 10:41 AM, leojhartiv <le...@gmail.com> wrote:
>
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org