Resolving in-workspace bundle dependencies [message #688117] |
Fri, 24 June 2011 00:36 |
Mark Elliot Messages: 13 Registered: June 2011 |
Junior Member |
|
|
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: Fri, 24 June 2011 00:40] Report message to a moderator
|
|
|
Re: Resolving in-workspace bundle dependencies [message #688187 is a reply to message #688117] |
Fri, 24 June 2011 05:44 |
Tin N/A Messages: 46 Registered: December 2010 |
Member |
|
|
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 05:50] Report message to a moderator
|
|
|
Re: Resolving in-workspace bundle dependencies [message #688279 is a reply to message #688117] |
Fri, 24 June 2011 10:26 |
|
Excellent answer. On the Virgo project itself we use "Project references" for workspace projects and then a classpath container for all 3rd party dependencies.
------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03261 seconds