On 2 Nov 2012, at 17:19, Christopher BROWN wrote: > Hello, > > Using current builds of BND (GitHub/Cloudbees), and referring to the > documentation for BND, I'm observing odd behavior. > > It seems that BND only adds "javax" packages automatically to the > MANIFEST.MF when the ".bnd" file contains NO "Import-Package" directive.
Do you have a wildcard at the end of your Import-Package directive? Without a wildcard bnd won't add to your list of packages. bnd's default Import-Package is "*" which will be expanded to include all necessary imports. If you specific an Import-Package of "foo" then bnd will only use your given imports. If you want to add or extend packages to Import-Package, but still want bnd to expand it to include any necessary packages then use "foo, *" (ie. with a wildcard at the end) If you want to remove packages from the generated Import-Package then use something like "foo, !bar, *" > However, I need to add explicit headers because BND can't guess the > version ranges, so I add the headers manually with the version ranges. And > suddenly, BND doesn't seem to detect and add the "javax" packages any more. > > Therefore, I'm getting ClassNotFoundExceptions from Apache Felix at runtime > (with the helpful message telling me that the JDK and Felix export it) > because there's no Import-Package header. This is similar to "classic" > classpath problems in Java in that the failure occurs only when a specific > code path is executed... > > I can test this by adding a dummy line such as: > javax.sql.DataSource = null; > > ...anywhere in the bundle. This only fails when the JVM reaches this code, > it doesn't prevent the bundle loading. Apache Felix obviously can't detect > the problem when resolving the bundle because it's not explicitly imported, > because BND isn't adding it. > > However, if I put say "javax.foobar.*" in my directive, BND gives me a > warning. > > Is this a bug in BND ? Is there a way to make it "grumpy" so that it'll > refuse to build my bundle if my imports are wrong? > > Thanks, > Christopher --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

