[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.platform] Re: Plugin runs when launched from Eclipse, "cycle detected in classpath" with Export Wizard
|
Irfan Hamid wrote:
Hi,
I have three different plugin projects in my workspace, e.g.:
com.name.prod, com.name.prod.unit1 and com.name.prod.unit2.
Unfortunately I have circular dependencies among these plugins. The main
plugin is com.name.prod, when I run it from within Eclipse as a plugin,
it runs and doesn't give me a problem. However, when I try to export it
using the plugin Export Wizard, it says "Problems during export. Reason:
A cycle was detected when generating the classpath com.name.prod,
com.name.prod.unit1, com.name.prod"
I have tried removing the plugin dependencies among the projects and
instead putting the required packages as explicit dependant packages but
still no solution.
I have tried adding and removing the .classpath file from the build
manifest of the plugins. Still the same problem.
Any help would be highly appreciated.
TIA,
Irfan Hamid.
OSGi does not allow circular dependencies. At least not directly. I
see three main options:
1) Merge the plugins that depend on eachother into a single plugin.
2) If the interaction between them is at arms length (i.e. by
Class.forName(String) and reflection rather than direct references to
class names) you may be able to do this using a buddy policy:
Let's assume that com.name.prod is the main module and is not directly
aware of prod1. Add the following to com.name.prod's manifest:
Eclipse-BuddyPolicy: registered
Now, in com.name.prod.unit1, which has com.name.prod as a dependency,
add the following to the manifest:
Eclipse-RegisterBuddy: com.name.prod
By doing this, com.name.prod's classloader will be able to get at any of
com.name.prod.unit1's exported packages, using the Class.forName(String)
method. However com.name.prod, since it does not have
com.name.prod.unit1 as a dependency, cannot directly reference any of
unit1's classes in code.
3) Create an extension point in com.name.prod and allow
com.name.prod.unit1 and com.name.prod.unit2 to add extensions to that
extension point. I unfortunately can't help you with this one, since
writing extension points requires writing an XML DTD, which I've never
figured out.
Good luck.
Matt