Skip to main content



      Home
Home » Eclipse Projects » Virgo » Resolving in-workspace bundle dependencies
Resolving in-workspace bundle dependencies [message #688117] Thu, 23 June 2011 20:36 Go to next message
Eclipse UserFriend
What's the trick for getting in-workspace dependencies to work between bundle projects?

Just as a simple experiment I tried:

1. Create bundle A
a. Create class com.foo.bar.Baz
b. Edit manifest, export com.foo.bar.Baz

2. Create bundle B
a. Create class com.xyz.Joe
b. Add constructor, instantiate new com.foo.bar.Baz

Now the fun begins: Trying to add com.foo.bar.Baz as a dependency in the manifest of bundle B, I find that the add prompt is grayed out (why?). No worries, we'll just do it manually, and add the dependency in the MANIFEST.MF editor:

Import-Package: com.foo.bar

Saved.

Now in theory this should fix the error that `Baz` cannot be resolved to a type, but alas, it does not. What's the trick?

Details: Eclipse Indigo JEE + latest milestone build of Virgo IDE as instructed by the Virgo/Tooling website.

[Updated on: Thu, 23 June 2011 20:40] by Moderator

Re: Resolving in-workspace bundle dependencies [message #688187 is a reply to message #688117] Fri, 24 June 2011 01:44 Go to previous messageGo to next message
Eclipse UserFriend
Short version:
Right-click on the project name in Navigator or Package Explorer, choose Properties, then choose "Project references" and tick the bundle(s) that contain dependencies you need.

Longer version:
There are two mechanisms by which dependencies are resolved. "Container" dependencies are provided for your projects automatically by any bundles deployed into any of Virgo's repository directories (typically, that would be the {virgo-home}/repository/usr). OTOH, if your dependency-providing bundle is only located in your workspace, you need to reference it in the properties as described above. And additionally, you also need to Add (assign) it to the server in correct order (dependant bundles after the bundles providing dependencies) if you want it all to work when running it from IDE.

Of course, for all this to work you also need to have the correct facet for the project selected in the Properties (i.e. the EclipsRT OSGi bundle facet), and also in the Properties, the Targeted runtime must be set to the Virgo server instance you're using for development.

[Updated on: Fri, 24 June 2011 01:50] by Moderator

Re: Resolving in-workspace bundle dependencies [message #688279 is a reply to message #688117] Fri, 24 June 2011 06:26 Go to previous messageGo to next message
Eclipse UserFriend
Excellent answer. On the Virgo project itself we use "Project references" for workspace projects and then a classpath container for all 3rd party dependencies.
Re: Resolving in-workspace bundle dependencies [message #688360 is a reply to message #688187] Fri, 24 June 2011 10:09 Go to previous messageGo to next message
Eclipse UserFriend
Thanks, that *almost* fixed everything for me.

Some additional details for users struggling with the same problem:

1. MANIFEST.MF *must* be located at src/META-INF/MANIFEST.MF
2. In addition to making sure "EclipseRT OSGi Bundle" is in the project facets, a Virgo Web Server Runtime must also be specified (use the Runtimes tab in the Project Facets window)
Re: Resolving in-workspace bundle dependencies [message #689545 is a reply to message #688360] Mon, 27 June 2011 15:55 Go to previous message
Eclipse UserFriend
You can also use dependency management tools like Maven or Ivy to help with cross-project dependency resolution. The only gotcha there is that you have to update dependencies in two places then, the MANIFEST.MF and the dependency management config (pom.xml for Maven, for example).
Previous Topic:Plan Concepts
Next Topic:Problem launching Virgo WS
Goto Forum:
  


Current Time: Tue Jul 01 16:52:24 EDT 2025

Powered by FUDForum. Page generated in 0.04243 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top