2009/6/23 Andreas Mucha <[email protected]>

> Hello all,
>
> i have the following packaging problem.
> I have e.g. the following package structure:
>
> a.b
>   SomeInterface.java
>   SomeBundleActivator.java
>

FYI your bundle activator does not have to be exported, it only needs to be
a public class.
Best-practice is to keep your activator under the implementation package, as
it's often an
implementation detail rather than part of the external API


> a.b.impl
>   SomeInterfaceImpl.java
>
> Based on this i create a bnd file like this:
>
> Bundle-Version: 1.0.0
> Export-Package: a.b;version=1.0.0
> Bundle-Name: a.b
> Bundle-SymbolicName: SomeBundle
> Bundle-Activator: a.b.SomeBundleActivator
> Bundle-Vendor: AnM
>
> If i create a bundle based on this i get an error while starting
> because the a.b.impl package cannot be resolved.
> How can this be??? It is only used within the bundle.


Check the package actually exists in your bundle (ie. "jar tvf
myBundle.jar")

Because if you are using Bnd's Ant task then you need to tell it to also
pull in the private packages as well as the exported packages like so:

   Export-Package: a.b;version=1.0.0
   Private-Package: a.b.impl

Otherwise you'll just end up with the exported packages in the final bundle.
( Bnd uses a "pull" approach, as explained in http://aqute.biz/Code/Bnd )

FYI if you use the 2.0.0 maven-bundle-plugin then it will automatically add
the Private-Package instruction based your source code if you miss it out,
before calling Bnd to create the actuall bundle

HTH

I will hide the a.b.impl package. Only the a.b package
> should be available to other bundles.
> I thought that a bundle is selfcontaint.
>
> If i export all packages than it works.
>
> Can you tell me what is happening here ?
>
> Thanks in advance.
>
> Andreas .
> --
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
-- 
Cheers, Stuart

Reply via email to