You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "COPPENS, Fabien" <fa...@capgemini.com> on 2007/08/28 17:32:05 UTC

Cyclic dependency problem

Hi all.
I have just joined the list, so please forgive me if the exact same
question has already been posted.
 
Here is my use case :
I have a project CORE_A which exposes a facade in the form of an EJB,
which is built in a separate project EJB_A.
I have a project CORE_B which exposes a facade in the form of an EJB,
which is built in a separate project EJB_B.
CORE_A needs to call remote EJB_B, so it has a dependency on the client
jar of EJB_B.
CORE_B needs to call remote EJB_A, so it has a dependency on the client
jar of EJB_A.
EJB_A depends on CORE_A for its build.
EJB_B depends on CORE_B for its build.
 
In my CORE_A and CORE_B POM files, I have tried to avoid getting a
cyclic dependency error in the build phase
by :
- using a client classifier for the depency of CORE to EJB client
- using an exclusion
e.g. for the pom.xml of the CORE_A project :
 
<dependency>
<groupId>com.acme</groupId>
<artifactId>EJB-B</artifactId>
<version>${applicationVersion}</version>
<classifier>client</classifier>
<exclusions>
<exclusion>
<groupId>com.acme</groupId>
<artifactId>CORE-B</artifactId>
</exclusion>
</exclusions>
</dependency>
 
But when I launch the install goal, I immediately get a cyclic
dependency error message, which seems to indicate that Maven
is ignoring my <classifier> or <exclusion> modifiers, and basing its
graph calculation solely on the list of depencies.
I use Maven 2.0.7.
 
Has anyone got a solution ?
 
Regards,
Fabien Coppens
 


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.

Re: Cyclic dependency problem

Posted by Tim Kettler <ti...@udo.edu>.
Hi,

the excludes won't help here. Maven calculates the dependencies based on 
the projects in your reactor build. And as both, the main ejb-jar and 
the ejb-client-jar are built by the same project the cyclic dependency 
remains.

Your best option is to factor out the exposed ejb interfaces to seperate 
projects and then let both, the ejb and core projects depend on that.

-Tim

COPPENS, Fabien schrieb:
> Hi all.
> I have just joined the list, so please forgive me if the exact same
> question has already been posted.
>  
> Here is my use case :
> I have a project CORE_A which exposes a facade in the form of an EJB,
> which is built in a separate project EJB_A.
> I have a project CORE_B which exposes a facade in the form of an EJB,
> which is built in a separate project EJB_B.
> CORE_A needs to call remote EJB_B, so it has a dependency on the client
> jar of EJB_B.
> CORE_B needs to call remote EJB_A, so it has a dependency on the client
> jar of EJB_A.
> EJB_A depends on CORE_A for its build.
> EJB_B depends on CORE_B for its build.
>  
> In my CORE_A and CORE_B POM files, I have tried to avoid getting a
> cyclic dependency error in the build phase
> by :
> - using a client classifier for the depency of CORE to EJB client
> - using an exclusion
> e.g. for the pom.xml of the CORE_A project :
>  
> <dependency>
> <groupId>com.acme</groupId>
> <artifactId>EJB-B</artifactId>
> <version>${applicationVersion}</version>
> <classifier>client</classifier>
> <exclusions>
> <exclusion>
> <groupId>com.acme</groupId>
> <artifactId>CORE-B</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
>  
> But when I launch the install goal, I immediately get a cyclic
> dependency error message, which seems to indicate that Maven
> is ignoring my <classifier> or <exclusion> modifiers, and basing its
> graph calculation solely on the list of depencies.
> I use Maven 2.0.7.
>  
> Has anyone got a solution ?
>  
> Regards,
> Fabien Coppens
>  
> 
> 
> This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.
> 


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