Reputation: 4148
when I try to export a plug-in using Eclipse, I get the error message "A cycle was detected when generating the classpath".
This is followed by a list of plug-ins which apparently shows the cycle, in this form:
a.b.c.plugin-u_version,
**a.b.c.plugin-w_version**,
a.b.c.plugin-x_version,
a.b.c.plugin-y_version,
a.b.c.plugin-z_version,
**a.b.c.plugin-w_version**.
Note that according to this list, it appears that plugin-w depends on plugin-z, but plugin-z depends on plugin-w.
When I check the dependencies of these plugins, both by opening the MANIFEST.MF and checking the Dependencies tab, and by looking at the Required-bundle: property in the manifest, I confirm all of these dependencies, up until the very last one.
That is, in the MANIFEST.MF for a.b.c.plugin-z, I do not see any dependency on plugin-w.
Am I reading the error right? If so, how can I debug where the error is coming from?
Upvotes: 0
Views: 2035
Reputation: 11
Another quick and dirty solution is to check the "Allow for binary cycles in target platform" checkbox at the bottom of the Export window.
Upvotes: 1
Reputation: 4148
This question is difficult to generalize, and I have not done the tedious full analysis needed to, so I'm answering my own question and hoping it helps others who search for the same error.
The error I get, when exporting a plug-in, is "A cycle was detected when generating the classpath", but I don't see the cycle by examining the dependencies of each plug-in.
The problem comes from the fact that there is a fragment involved. One of the plug-ins in the chain, let's say it's plugin.x, above, is a fragment host for another plug-in that is not listed in the dependency chain, and that that second plug-in has a dependency that introduces the cycle.
Let's call the plug-in that is not listed in the dependency chain, "plugin.x1".
In the MANIFEST.MF file for plugin.x1, I see the attribute "Fragment-Host: a.b.c.plugin-x". This attribute makes plugin-x dependent on plugin-x1.
But another attribute in the MANIFEST.MF file for plugin.x1 reads: "Import-Package: a.b.c.plugin-w".
So the dependency is: w depends on x; x is a fragment host for x1; and x1 depends on w. Thus the cycle.
The clean solution is: redesign my code to avoid circular dependencies by avoiding the fragment host configuration.
The quick and dirty solution, which works for me is: close the project plugin.x1 whenever I want to export my plugin.u.
Upvotes: 1