dev@glassfish.java.net

Re: Export-Package and the mandatory-directive

From: Sanjeeb Sahoo <Sahoo_at_Sun.COM>
Date: Wed, 27 Oct 2010 19:09:55 +0530

On Wednesday 27 October 2010 01:54 AM, Sheetal Vartak wrote:
> Hi Richard,
>
> On Oct 26, 2010, at 1:10 PM, Richard S. Hall wrote:
>
>
>>
>> On 10/26/10 16:00, Sheetal Vartak wrote:
>>
>>> Hi Richard,
>>>
>>> Thanks for your reply.
>>>
>>> Yes StateHolderSaver is a class. Even if I specify com.sun.faces.application.view.*, I see the same issue.
>>>
>> You probably don't need the ".*" if its the only package.
>>
>> You need to have the metadata correct or else things won't work. If you specify com.sun.faces.application.view, then what is your Import-Package? Below it is using StateHolderSaver in the requirement, which wouldn't work. Both the import and the export should be com.sun.faces.application.view.
>>
> I had tried with com.sun.faces.application.view.* in both Export-Package and Import-Package.
>
>>
>>> One thing to note is that :
>>> jsf-api.jar has only 1 class i.e. StateHolderSaver that belongs to the package com.sun.faces.application.view. Whereas the jsf-impl.jar also has the same package with a lot more classes but it needs to import com.sun.faces.application.view.StateHolderSaver from jsf-api.jar.
>>>
>> That's not going to happen then. If you import a package, you cannot also have that package locally. Imported packages override local packages. You cannot do split packages with Import-Package/Export-Package. If you really need to do that, then you would have to use Require-Bundle.
>>
> Hmm. Looks like this is the issue. I'll look into using Require-Bundle.
>
>
No, don't use Require-Bundle - that's really bad. Avoid the split
package scenario. So, you need to consolidate

com.sun.faces.application.view

package in a single module and jsf-impl seems to be the more appropriate
module. Alternatively, merge jsf-api and jsf-impl into a single module
if they are not really independently usable. Look mail.jar or
weld-osgi-bundle.jar in glassfish for examples of such bundles.

Sahoo