views:

349

answers:

3

I have to build two eclipse-plugin projects into two separate jars with each one dependent on the other for compiling. Eclipse IDE complains about "cyclical dependency...". How do I build these plugin jars? I guess running these plugins by just putting them in the eclipse/plugin folder should be smooth.

+7  A: 

If you have a cyclic dependency, you have two choices:

  1. You can get rid of it by putting them into one JAR. If they truly depend on each other, they really are just one entity.
  2. You can split out the packages that cause the cyclic dependency into a third JAR and deploy two plug-ins with two JARs each.
duffymo
+1 cyclical dependencies will hurt you again and again. Finding solutions for every single problem they cause can be come very tiring.
Joachim Sauer
Java itself fell into it. java.lang, java.io, and java.util are all one monster package.
duffymo
A: 

If (and only if) you really cannot get rid of this cyclical dependency, You could use a loose form of dependency between your plugins: DynamicImport-Package
(as suggested in this blog entry, with an emphasis on getting rid of the cycle though)

VonC
A: 

Or you can do a maven approach, where you deploy a versioned jar to the repository.

Then project A depends on the latest released version of B in the repository and B depends on the latest version of A in the repository.

Thorbjørn Ravn Andersen