Comment #3 on issue 311 by mcculls: Some guice extensions do not resovle under OSGi. http://code.google.com/p/google-guice/issues/detail?id=311
If you want to keep these classes internal but expose them to extensions, then the best solution is to mark the extensions as fragments that attach to the main Guice bundle. Fragment bundles use the same classloader as their host and will therefore see internal packages. (there are other "friend" style mechanisms in Equinox, but these are non-standard) I've attached a patch that adds the necessary fragment headers and cleans up some import statements as well. FYI: you may see a few Bnd warnings about non-matching referrals, but these can be safely ignored. Regarding a tool to validate OSGi bundles, you can use Bnd to verify the content: java -jar lib/build/bnd-0.0.305.jar print -verify build/dist/*-snapshot.jar which will report the missing internal import for the extensions and other extra bundles. Note these problems will still be reported even when the extensions are marked fragments, but it won't now cause a problem in practice. Also the main Guice bundle will always report a couple of missing imports: com.google.common.base com.google.inject.internal.asm.util both due to some indirect/string references that are never used at runtime. For a better test of the actual bundles you could use one of the OSGi frameworks and check the bundles all install and resolve. OSGi integration testing is unfortunately still ad-hoc these days (tooling is being developed as I type ;) I don't have much time this month (or next!) but I could provide some tests later on this year if you're interested. Until then feel free to look at the following links: http://wiki.ops4j.org/display/ops4j/Pax+Runner http://felix.apache.org/site/apache-felix-file-install.html You can use Pax-Runner to download and setup an OSGi framework (say the reference implementation, Equinox) and deploy the FileInstall bundle. This monitors a folder and installs any JARs you add, and uninstalls any that are removed. (shameless plug: the OSGi in Action book might also help http://manning.com/hall/) Attachments: GUICE_ISSUE_311.patch 5.0 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-guice-dev?hl=en -~----------~----~----~----~------~----~------~--~---
