PDA

View Full Version : Cycles in Dependency Graph


maddalab
May 12th, 2008, 04:12 PM
I am trying to use Spring Dynamic Modules for a very simple application, very quickly I ran into eclipse complaining about the existence for cycles in dependency graph for my simple application.

Eventually I decided to restart development in a fresh workspace.

I imported the following 4 bundles into my workspace, using File -> Import -> Plug-ins and Fragment from eclipse

spring beans
spring context
spring jdbc
spring orm

all version 2.5.4

Then I selected the manifest for the spring jdbc, in the dependency tab selected "show dependent plug-ins and fragments"

the hierarchy shows

spring orm depends on spring jdbc
spring orm & jdbc depend on spring context ($%#%#%)
spring context depends on spring orm

resulting in a loop between context, jdbc, orm

Nope, I am not crazy, this is definitely what eclipse thinks, checked and double-checked and ...

Verified that the Import-Packages directive in context has at least 1 reference to orm

org.springframework.orm.jpa.support

the cycle does not seem to matter much until I try to use both spring jdbc and orm in my application at the same time, it is a no go, as eclipse will not even build.

What am I doing wrong, or is this a bug (either in spring bundles or equinox/eclipse)

Costin Leau
May 13th, 2008, 04:59 AM
The optional import is required since the spring context jar contains some classes that provide dynamic loading for certain environments. While unfortunate the package dependency should not create problems when running your application under Eclipse Equinox. I haven't used Eclipse PDE that much but I would suggest to use the Spring-DM target platform (kindly supported by Spring-IDE platform site): http://static.springframework.org/osgi/docs/current/reference/html/appendix-pde-integration.html

Hope this helps,

Costin Leau
May 13th, 2008, 05:02 AM
By the way, I've just raised an issue to potentially address this in the future:
http://jira.springframework.org/browse/SPR-4802

lakemove
May 15th, 2008, 04:01 PM
Almost in every jar about spring (2.5.4) , you can find that it imports what it exports !

im developing RCP , the cycle stop eclipse from exporting entire app .

then i export the spring jars manually , it is really...

will it be fixed ?

Andreas Senft
May 16th, 2008, 01:45 AM
will it be fixed ?

As I see, the issue is currently scheduled for the 2.5.5 release. In any case you may vote for the issue to increase its importance.

Costin Leau
May 16th, 2008, 06:23 AM
Importing exported packages is not a bad practice - quite the contrary.
See this blog entry from Peter Kriens: http://www.osgi.org/blog/2007/04/importance-of-exporting-nd-importing.html
I haven't used Eclipse RCP but since this scenario is supported, I think there is a problem with the tool itself.
Consider searching their mailing list or even posting - maybe there is some workaround.

Costin Leau
May 16th, 2008, 06:24 AM
Just to clarify - there is one thing to have cycles between packages (bad) and another to importe what you're exporting (good).

lakemove
May 16th, 2008, 07:25 AM
and i agree that it is the RCP tools' problem.

thank you for pointing out, :P

lakemove
May 24th, 2008, 11:53 AM
though it maybe not belongs to this topic, i will write out my problem and solution for continuous.

when i exporting the RCP Product, it told me

a cycle was detected when generating spring web

i worked on that damn problem for really a long time, finally i found that , in my plugins directory, contains :

spring.jar
spring-web.jar

then i deleted the spring-web.jar, it works :D

since both above jars exports "org.springframework.web" package, it cause confusion when generating classpath(for exporting) . i guess