You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Andreas Mucha <si...@gmx.net> on 2009/06/23 20:35:49 UTC
packaging problem in bundle
Hello all,
i have the following packaging problem.
I have e.g. the following package structure:
a.b
SomeInterface.java
SomeBundleActivator.java
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.
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: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: packaging problem in bundle
Posted by Andreas Mucha <si...@gmx.net>.
Sounds good. I will check this today in the evening.
Thanks .
-------- Original-Nachricht --------
> Datum: Tue, 23 Jun 2009 21:13:47 +0200
> Von: Filippo Diotalevi <fi...@gmail.com>
> An: users@felix.apache.org
> Betreff: Re: packaging problem in bundle
> On Tue, Jun 23, 2009 at 8:35 PM, Andreas Mucha<si...@gmx.net> wrote:
> > i have the following packaging problem.
> > I have e.g. the following package structure:
> >
> > a.b
> > SomeInterface.java
> > SomeBundleActivator.java
> >
> > 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
>
> I think you're missing the declaration:
> Private-Package: a.b.impl
>
> Check
> http://www.nabble.com/Re%3A-Weird-behavior-with-Maven-Bundle-Plugin%2C-classes-not-included-in--bundle-p22473673.html
>
>
>
> --
> Filippo Diotalevi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: packaging problem in bundle
Posted by Filippo Diotalevi <fi...@gmail.com>.
On Tue, Jun 23, 2009 at 8:35 PM, Andreas Mucha<si...@gmx.net> wrote:
> i have the following packaging problem.
> I have e.g. the following package structure:
>
> a.b
> SomeInterface.java
> SomeBundleActivator.java
>
> 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
I think you're missing the declaration:
Private-Package: a.b.impl
Check
http://www.nabble.com/Re%3A-Weird-behavior-with-Maven-Bundle-Plugin%2C-classes-not-included-in--bundle-p22473673.html
--
Filippo Diotalevi
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: packaging problem in bundle
Posted by Andreas Mucha <si...@gmx.net>.
The Private-Package settting finally worked :-)
Thanks for your effort .
Andreas .
-------- Original-Nachricht --------
> Datum: Wed, 24 Jun 2009 09:09:52 +0200
> Von: Stuart McCulloch <mc...@gmail.com>
> An: users@felix.apache.org
> Betreff: Re: packaging problem in bundle
> 2009/6/24 Andreas Mucha <si...@gmx.net>
>
> > I know. This was the original plan.
> > But it does not work.
> > If the activator is in the a.b.impl package
> > i will recive errors like '...unable to load class activator' .
> > Only if all packages are exported via bundle, it works.
> >
>
> this really sounds like your build is not working properly and
> you are not getting the "impl" classes in your final JAR file.
>
> please do a "jar tvf" on your JAR, as I explained later on in
> my reply (my comments were interleaved with your email)
>
> if the impl classes are missing then add this Bnd instruction:
>
> Private-Package: a.b.impl
>
> as Filippo also suggested - this will then pull in your impl
> classes, at which point moving your bundle activator to
> also be in 'impl' will also work (as I also explained in my
> earlier reply ;)
>
> HTH
>
>
> > -------- Original-Nachricht --------
> > > Datum: Tue, 23 Jun 2009 21:12:40 +0200
> > > Von: Stuart McCulloch <mc...@gmail.com>
> > > An: users@felix.apache.org
> > > Betreff: Re: packaging problem in bundle
> >
> > > 2009/6/23 Andreas Mucha <si...@gmx.net>
> > >
> > > > 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: users-unsubscribe@felix.apache.org
> > > > For additional commands, e-mail: users-help@felix.apache.org
> > > >
> > > >
> > > --
> > > Cheers, Stuart
> >
> > --
> > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
> --
> Cheers, Stuart
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: packaging problem in bundle
Posted by Stuart McCulloch <mc...@gmail.com>.
2009/6/24 Andreas Mucha <si...@gmx.net>
> I know. This was the original plan.
> But it does not work.
> If the activator is in the a.b.impl package
> i will recive errors like '...unable to load class activator' .
> Only if all packages are exported via bundle, it works.
>
this really sounds like your build is not working properly and
you are not getting the "impl" classes in your final JAR file.
please do a "jar tvf" on your JAR, as I explained later on in
my reply (my comments were interleaved with your email)
if the impl classes are missing then add this Bnd instruction:
Private-Package: a.b.impl
as Filippo also suggested - this will then pull in your impl
classes, at which point moving your bundle activator to
also be in 'impl' will also work (as I also explained in my
earlier reply ;)
HTH
> -------- Original-Nachricht --------
> > Datum: Tue, 23 Jun 2009 21:12:40 +0200
> > Von: Stuart McCulloch <mc...@gmail.com>
> > An: users@felix.apache.org
> > Betreff: Re: packaging problem in bundle
>
> > 2009/6/23 Andreas Mucha <si...@gmx.net>
> >
> > > 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: users-unsubscribe@felix.apache.org
> > > For additional commands, e-mail: users-help@felix.apache.org
> > >
> > >
> > --
> > Cheers, Stuart
>
> --
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
--
Cheers, Stuart
Re: packaging problem in bundle
Posted by Andreas Mucha <si...@gmx.net>.
I know. This was the original plan.
But it does not work.
If the activator is in the a.b.impl package
i will recive errors like '...unable to load class activator' .
Only if all packages are exported via bundle, it works.
-------- Original-Nachricht --------
> Datum: Tue, 23 Jun 2009 21:12:40 +0200
> Von: Stuart McCulloch <mc...@gmail.com>
> An: users@felix.apache.org
> Betreff: Re: packaging problem in bundle
> 2009/6/23 Andreas Mucha <si...@gmx.net>
>
> > 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: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
> --
> Cheers, Stuart
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: packaging problem in bundle
Posted by Stuart McCulloch <mc...@gmail.com>.
2009/6/23 Andreas Mucha <si...@gmx.net>
> 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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
--
Cheers, Stuart