You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by jiangshachina <ji...@gmail.com> on 2006/11/10 10:51:42 UTC

Dependency cycle?

Hello guys,
I suddenly have a virtual case just in mind.
There are two projects, A and B, each of them depends on the other one.
How do Maven to deal with the dependency cycle?

a cup of Java, cheers!
Sha Jiang
-- 
View this message in context: http://www.nabble.com/Dependency-cycle--tf2606748s177.html#a7274021
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: Dependency cycle?

Posted by jiangshachina <ji...@gmail.com>.
Hello,
I made a simple test with Eclipse just now.
Eclipse doesn't allow project dependency cycle.
Then I think Maven does the same.

Assumes project A depends on project B, then B must produces artifact and
installs the artifact to repository firstly, then A could depend on it.
But B depends on A, then B want A to be installed at repository, too.
The cycle can not be resolved.

a cup of Java, cheers!
Sha Jiang


jiangshachina wrote:
> 
> Hello guys,
> I suddenly have a virtual case just in mind.
> There are two projects, A and B, each of them depends on the other one.
> How do Maven to deal with the dependency cycle?
> 
> a cup of Java, cheers!
> Sha Jiang
> 

-- 
View this message in context: http://www.nabble.com/Dependency-cycle--tf2606748s177.html#a7274732
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: Dependency cycle?

Posted by manojkokane <ma...@gmail.com>.
Sha Jiang,
 
      As maven does not support circular dependency, you can try this to
resolve this.
 
      Let's say you have module 'A' and module 'B', where both depends on
other one.
      You can add one more module say 'C' which will be packaged to jar
consisting common classes required for module A and B. Then add dependency
of module 'C' in both 'A' and 'B'. 

     Hope this helps... :)
      




-----
Thanks, 
ManojK
--
View this message in context: http://maven.40175.n5.nabble.com/Dependency-cycle-tp55414p5875098.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: Dependency cycle?

Posted by Stephen Connolly <st...@gmail.com>.
Try building them in the same reactor and Maven will say something like:
"circular dependencies are not supported"

2009/5/13 kretes <kr...@gazeta.pl>

>
> Hello,
>
> I'd like to comment on this - maven is able to deal with cyclic
> dependencies, but You have to do this cunningly.
> It's not a good pattern, but it happens, and I would be willing to change
> the statement that 'maven is not able to deal with cyclic'.
> Here is how it goes:
> project A - you create it, install it in the repository just like that
> project B - create, add dependency to A, install.
> project A - modify dependencies and add dependency to B
>
> Here You are, You have a cyclic dependency with maven support. Of course
> You
> have to deal manually with making changes in the projects.
>
> BTW - where is written that 'maven does not support them' ? :)
>
>
>
> franz see wrote:
> >
> > hehehe :-) my bad :-)
> >
> >
> > Andrew Williams-5 wrote:
> >>
> >> It is a rhetorical question - meaning that it is impossible to build
> >> such a system, thus Maven does not support it :)
> >>
> >> A
> >>
> >> franz see wrote:
> >>> Good day to you, Andy,
> >>>
> >>> I'm not sure if any are build at all, that's because your whole build
> >>> will
> >>> fail.
> >>>
> >>> Cheers,
> >>> Franz
> >>>
> >>>
> >>> Andrew Williams-5 wrote:
> >>>
> >>>> If two projects depend on each other which gets built first?
> >>>> In this situation either one must be optional or they must be in the
> >>>> same artifact.
> >>>>
> >>>> Andy
> >>>>
> >>>> franz see wrote:
> >>>>
> >>>>> Good day to you Sha Jiang,
> >>>>>
> >>>>> Maven can not handle cyclic dependencies. It will give you a cyclic
> >>>>> dependency error
> >>>>>
> >>>>> Cheers,
> >>>>> Franz
> >>>>>
> >>>>>
> >>>>> jiangshachina wrote:
> >>>>>
> >>>>>
> >>>>>> Hello guys,
> >>>>>> I suddenly have a virtual case just in mind.
> >>>>>> There are two projects, A and B, each of them depends on the other
> >>>>>> one.
> >>>>>> How do Maven to deal with the dependency cycle?
> >>>>>>
> >>>>>> a cup of Java, cheers!
> >>>>>> Sha Jiang
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>> ---------------------------------------------------------------------
> >>>> 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/Dependency-cycle--tp7274021p23522952.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: Dependency cycle?

Posted by kretes <kr...@gazeta.pl>.
Hello,

I'd like to comment on this - maven is able to deal with cyclic
dependencies, but You have to do this cunningly.
It's not a good pattern, but it happens, and I would be willing to change
the statement that 'maven is not able to deal with cyclic'.
Here is how it goes:
project A - you create it, install it in the repository just like that
project B - create, add dependency to A, install.
project A - modify dependencies and add dependency to B

Here You are, You have a cyclic dependency with maven support. Of course You
have to deal manually with making changes in the projects.

BTW - where is written that 'maven does not support them' ? :)



franz see wrote:
> 
> hehehe :-) my bad :-)
> 
> 
> Andrew Williams-5 wrote:
>> 
>> It is a rhetorical question - meaning that it is impossible to build 
>> such a system, thus Maven does not support it :)
>> 
>> A
>> 
>> franz see wrote:
>>> Good day to you, Andy,
>>>
>>> I'm not sure if any are build at all, that's because your whole build
>>> will
>>> fail.
>>>
>>> Cheers,
>>> Franz 
>>>
>>>
>>> Andrew Williams-5 wrote:
>>>   
>>>> If two projects depend on each other which gets built first?
>>>> In this situation either one must be optional or they must be in the 
>>>> same artifact.
>>>>
>>>> Andy
>>>>
>>>> franz see wrote:
>>>>     
>>>>> Good day to you Sha Jiang,
>>>>>
>>>>> Maven can not handle cyclic dependencies. It will give you a cyclic
>>>>> dependency error
>>>>>
>>>>> Cheers,
>>>>> Franz
>>>>>
>>>>>
>>>>> jiangshachina wrote:
>>>>>   
>>>>>       
>>>>>> Hello guys,
>>>>>> I suddenly have a virtual case just in mind.
>>>>>> There are two projects, A and B, each of them depends on the other
>>>>>> one.
>>>>>> How do Maven to deal with the dependency cycle?
>>>>>>
>>>>>> a cup of Java, cheers!
>>>>>> Sha Jiang
>>>>>>
>>>>>>     
>>>>>>         
>>>>>   
>>>>>       
>>>> ---------------------------------------------------------------------
>>>> 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/Dependency-cycle--tp7274021p23522952.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: Dependency cycle?

Posted by franz see <fr...@gmail.com>.
hehehe :-) my bad :-)


Andrew Williams-5 wrote:
> 
> It is a rhetorical question - meaning that it is impossible to build 
> such a system, thus Maven does not support it :)
> 
> A
> 
> franz see wrote:
>> Good day to you, Andy,
>>
>> I'm not sure if any are build at all, that's because your whole build
>> will
>> fail.
>>
>> Cheers,
>> Franz 
>>
>>
>> Andrew Williams-5 wrote:
>>   
>>> If two projects depend on each other which gets built first?
>>> In this situation either one must be optional or they must be in the 
>>> same artifact.
>>>
>>> Andy
>>>
>>> franz see wrote:
>>>     
>>>> Good day to you Sha Jiang,
>>>>
>>>> Maven can not handle cyclic dependencies. It will give you a cyclic
>>>> dependency error
>>>>
>>>> Cheers,
>>>> Franz
>>>>
>>>>
>>>> jiangshachina wrote:
>>>>   
>>>>       
>>>>> Hello guys,
>>>>> I suddenly have a virtual case just in mind.
>>>>> There are two projects, A and B, each of them depends on the other
>>>>> one.
>>>>> How do Maven to deal with the dependency cycle?
>>>>>
>>>>> a cup of Java, cheers!
>>>>> Sha Jiang
>>>>>
>>>>>     
>>>>>         
>>>>   
>>>>       
>>> ---------------------------------------------------------------------
>>> 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/Dependency-cycle--tf2606748s177.html#a7288565
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: Dependency cycle?

Posted by Andrew Williams <an...@handyande.co.uk>.
It is a rhetorical question - meaning that it is impossible to build 
such a system, thus Maven does not support it :)

A

franz see wrote:
> Good day to you, Andy,
>
> I'm not sure if any are build at all, that's because your whole build will
> fail.
>
> Cheers,
> Franz 
>
>
> Andrew Williams-5 wrote:
>   
>> If two projects depend on each other which gets built first?
>> In this situation either one must be optional or they must be in the 
>> same artifact.
>>
>> Andy
>>
>> franz see wrote:
>>     
>>> Good day to you Sha Jiang,
>>>
>>> Maven can not handle cyclic dependencies. It will give you a cyclic
>>> dependency error
>>>
>>> Cheers,
>>> Franz
>>>
>>>
>>> jiangshachina wrote:
>>>   
>>>       
>>>> Hello guys,
>>>> I suddenly have a virtual case just in mind.
>>>> There are two projects, A and B, each of them depends on the other one.
>>>> How do Maven to deal with the dependency cycle?
>>>>
>>>> a cup of Java, cheers!
>>>> Sha Jiang
>>>>
>>>>     
>>>>         
>>>   
>>>       
>> ---------------------------------------------------------------------
>> 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


Re: Dependency cycle?

Posted by franz see <fr...@gmail.com>.
Good day to you, Andy,

I'm not sure if any are build at all, that's because your whole build will
fail.

Cheers,
Franz 


Andrew Williams-5 wrote:
> 
> If two projects depend on each other which gets built first?
> In this situation either one must be optional or they must be in the 
> same artifact.
> 
> Andy
> 
> franz see wrote:
>> Good day to you Sha Jiang,
>>
>> Maven can not handle cyclic dependencies. It will give you a cyclic
>> dependency error
>>
>> Cheers,
>> Franz
>>
>>
>> jiangshachina wrote:
>>   
>>> Hello guys,
>>> I suddenly have a virtual case just in mind.
>>> There are two projects, A and B, each of them depends on the other one.
>>> How do Maven to deal with the dependency cycle?
>>>
>>> a cup of Java, cheers!
>>> Sha Jiang
>>>
>>>     
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> 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/Dependency-cycle--tf2606748s177.html#a7275207
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: Dependency cycle?

Posted by Andrew Williams <an...@handyande.co.uk>.
If two projects depend on each other which gets built first?
In this situation either one must be optional or they must be in the 
same artifact.

Andy

franz see wrote:
> Good day to you Sha Jiang,
>
> Maven can not handle cyclic dependencies. It will give you a cyclic
> dependency error
>
> Cheers,
> Franz
>
>
> jiangshachina wrote:
>   
>> Hello guys,
>> I suddenly have a virtual case just in mind.
>> There are two projects, A and B, each of them depends on the other one.
>> How do Maven to deal with the dependency cycle?
>>
>> a cup of Java, cheers!
>> Sha Jiang
>>
>>     
>
>   


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


Re: Dependency cycle?

Posted by franz see <fr...@gmail.com>.
Good day to you Sha Jiang,

Maven can not handle cyclic dependencies. It will give you a cyclic
dependency error

Cheers,
Franz


jiangshachina wrote:
> 
> Hello guys,
> I suddenly have a virtual case just in mind.
> There are two projects, A and B, each of them depends on the other one.
> How do Maven to deal with the dependency cycle?
> 
> a cup of Java, cheers!
> Sha Jiang
> 

-- 
View this message in context: http://www.nabble.com/Dependency-cycle--tf2606748s177.html#a7274599
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