You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Sudhir Dharmadhikari <sd...@verient.com> on 2010/07/20 07:20:25 UTC

Getting rid of Import-Package and Export-Package

I am trying simple osgi bundle which has every dependency embedded 
inside my bundle. By default, bundle-plugin creates several entries in 
Import-Package and Export-Package . I want to get rid of them 
completely. I tried several ways . If I try giving empty Import-Package 
, it fails at build. I tried blank _exportcontents, does not work too !

Any clue ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Getting rid of Import-Package and Export-Package

Posted by Justin Edelson <ju...@gmail.com>.
!* should work

On Jul 20, 2010, at 1:20 AM, Sudhir Dharmadhikari <sd...@verient.com> wrote:

> I am trying simple osgi bundle which has every dependency embedded inside my bundle. By default, bundle-plugin creates several entries in Import-Package and Export-Package . I want to get rid of them completely. I tried several ways . If I try giving empty Import-Package , it fails at build. I tried blank _exportcontents, does not work too !
> 
> Any clue ?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Getting rid of Import-Package and Export-Package

Posted by "Richard S. Hall" <he...@ungoverned.org>.
  On 7/21/10 13:02, Sudhir Dharmadhikari wrote:
> Hi Richard,
> Thanks for reply. I understand system bundle is redundant.

It isn't redundant, it is actually bad practice. The OSGi spec doesn't 
dictate what the system bundle exports, so framework implementations can 
vary here. And even if the spec defined a default value, most impls 
allow this to be configured, so you still couldn't be sure what you were 
getting from the system bundle.

Requiring the system bundle simply hides the real dependencies of your 
bundle so frameworks cannot know if they are actually satisfying them or 
not.

-> richard

> With following setup, I am getting Export-Package which are all my 
> application code. I got rid of that because I was getting several 
> errors. But may be that is not necessary (export should not have any 
> issues whether its being used by any other bundle or not) .
> Thanks.
>
> Richard S. Hall wrote:
>>
>> On 7/20/10 5:13 PM, Sudhir Dharmadhikari wrote:
>>> Hi Richard - Thanks for your inputs. It worked using !*. As per 
>>> documentation, it should export all classes and it is. Right now, no 
>>> other bundle will use any exported packages from my bundle , so I 
>>> wanted to get rid of this header at all from manifest . Similarly, 
>>> there are hundreds of entries in Import-Package but none of them is 
>>> needed . So I am disabling it as you suggested. That worked, but it 
>>> created new header Ignore-Package and ignored all the one which were 
>>> getting included. Just in case you wanted to see my configuration..
>>>
>>> Here is my code,
>>> <plugin>
>>> <groupId>org.apache.felix</groupId>
>>> <artifactId>maven-bundle-plugin</artifactId>
>>> <extensions>true</extensions>
>>> <version>2.1.0</version>
>>> <configuration> <instructions> 
>>> <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
>>> <Bundle-ClassPath>{maven-dependencies},.</Bundle-ClassPath>
>>> <Embed-Transitive>true</Embed-Transitive>
>>> <Bundle-RequiredExecutionEnvironment>JavaSE-1.6</Bundle-RequiredExecutionEnvironment> 
>>>
>>> <Bundle-Activator>osgi.Activator</Bundle-Activator>
>>> <Require-Bundle>org.eclipse.osgi;bundle-version="3.5.2"</Require-Bundle> 
>>>
>>> <Import-Package>!*</Import-Package>
>>> <Export-Package>!*</Export-Package>
>>
>> It doesn't seem like this should be necessary for Export-Package, 
>> since the default is to export nothing.
>>
>> The Ignore-Package header is purely informational from BND, it is 
>> ignored.
>>
>> Additionally, requiring the system bundle is really bad practice.
>>
>> -> richard
>>
>>> </instructions>
>>> </configuration> </plugin>
>>>
>>>
>>> Richard S. Hall wrote:
>>>>  On 7/20/10 1:20, Sudhir Dharmadhikari wrote:
>>>>> I am trying simple osgi bundle which has every dependency embedded 
>>>>> inside my bundle. By default, bundle-plugin creates several 
>>>>> entries in Import-Package and Export-Package . I want to get rid 
>>>>> of them completely. I tried several ways . If I try giving empty 
>>>>> Import-Package , it fails at build. I tried blank _exportcontents, 
>>>>> does not work too !
>>>>>
>>>>> Any clue ?
>>>>
>>>> I don't believe it should ever export anything by default, so if it 
>>>> is exporting it seems you must be telling it to do so somehow. On 
>>>> the other hand, it imports everything not included in the bundle by 
>>>> default. Not importing anything at all is harder than you might 
>>>> think. If you need any of the OSGi API then you need to import 
>>>> those packages; if you use any of the javax packages then you need 
>>>> to import them. But specifying !* should not import anything.
>>>>
>>>> -> richard
>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Getting rid of Import-Package and Export-Package

Posted by Sudhir Dharmadhikari <sd...@verient.com>.
Hi Richard,
Thanks for reply. I understand system bundle is redundant.
With following setup, I am getting Export-Package which are all my 
application code. I got rid of that because I was getting several 
errors. But may be that is not necessary (export should not have any 
issues whether its being used by any other bundle or not) .
Thanks.

Richard S. Hall wrote:
>
> On 7/20/10 5:13 PM, Sudhir Dharmadhikari wrote:
>> Hi Richard - Thanks for your inputs. It worked using !*. As per 
>> documentation, it should export all classes and it is. Right now, no 
>> other bundle will use any exported packages from my bundle , so I 
>> wanted to get rid of this header at all from manifest . Similarly, 
>> there are hundreds of entries in Import-Package but none of them is 
>> needed . So I am disabling it as you suggested. That worked, but it 
>> created new header Ignore-Package and ignored all the one which were 
>> getting included. Just in case you wanted to see my configuration..
>>
>> Here is my code,
>> <plugin>
>> <groupId>org.apache.felix</groupId>
>> <artifactId>maven-bundle-plugin</artifactId>
>> <extensions>true</extensions>
>> <version>2.1.0</version>
>> <configuration> <instructions> 
>> <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
>> <Bundle-ClassPath>{maven-dependencies},.</Bundle-ClassPath>
>> <Embed-Transitive>true</Embed-Transitive>
>> <Bundle-RequiredExecutionEnvironment>JavaSE-1.6</Bundle-RequiredExecutionEnvironment> 
>>
>> <Bundle-Activator>osgi.Activator</Bundle-Activator>
>> <Require-Bundle>org.eclipse.osgi;bundle-version="3.5.2"</Require-Bundle>
>> <Import-Package>!*</Import-Package>
>> <Export-Package>!*</Export-Package>
>
> It doesn't seem like this should be necessary for Export-Package, 
> since the default is to export nothing.
>
> The Ignore-Package header is purely informational from BND, it is 
> ignored.
>
> Additionally, requiring the system bundle is really bad practice.
>
> -> richard
>
>> </instructions>
>> </configuration> </plugin>
>>
>>
>> Richard S. Hall wrote:
>>>  On 7/20/10 1:20, Sudhir Dharmadhikari wrote:
>>>> I am trying simple osgi bundle which has every dependency embedded 
>>>> inside my bundle. By default, bundle-plugin creates several entries 
>>>> in Import-Package and Export-Package . I want to get rid of them 
>>>> completely. I tried several ways . If I try giving empty 
>>>> Import-Package , it fails at build. I tried blank _exportcontents, 
>>>> does not work too !
>>>>
>>>> Any clue ?
>>>
>>> I don't believe it should ever export anything by default, so if it 
>>> is exporting it seems you must be telling it to do so somehow. On 
>>> the other hand, it imports everything not included in the bundle by 
>>> default. Not importing anything at all is harder than you might 
>>> think. If you need any of the OSGi API then you need to import those 
>>> packages; if you use any of the javax packages then you need to 
>>> import them. But specifying !* should not import anything.
>>>
>>> -> richard
>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Getting rid of Import-Package and Export-Package

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 7/20/10 5:13 PM, Sudhir Dharmadhikari wrote:
> Hi Richard - Thanks for your inputs. It worked using !*. As per 
> documentation, it should export all classes and it is. Right now, no 
> other bundle will use any exported packages from my bundle , so I 
> wanted to get rid of this header at all from manifest . Similarly, 
> there are hundreds of entries in Import-Package but none of them is 
> needed . So I am disabling it as you suggested. That worked, but it 
> created new header Ignore-Package and ignored all the one which were 
> getting included. Just in case you wanted to see my configuration..
>
> Here is my code,
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <extensions>true</extensions>
> <version>2.1.0</version>
> <configuration> <instructions> 
> <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
> <Bundle-ClassPath>{maven-dependencies},.</Bundle-ClassPath>
> <Embed-Transitive>true</Embed-Transitive>
> <Bundle-RequiredExecutionEnvironment>JavaSE-1.6</Bundle-RequiredExecutionEnvironment>
> <Bundle-Activator>osgi.Activator</Bundle-Activator>
> <Require-Bundle>org.eclipse.osgi;bundle-version="3.5.2"</Require-Bundle>
> <Import-Package>!*</Import-Package>
> <Export-Package>!*</Export-Package>

It doesn't seem like this should be necessary for Export-Package, since 
the default is to export nothing.

The Ignore-Package header is purely informational from BND, it is ignored.

Additionally, requiring the system bundle is really bad practice.

-> richard

> </instructions>
> </configuration> </plugin>
>
>
> Richard S. Hall wrote:
>>  On 7/20/10 1:20, Sudhir Dharmadhikari wrote:
>>> I am trying simple osgi bundle which has every dependency embedded 
>>> inside my bundle. By default, bundle-plugin creates several entries 
>>> in Import-Package and Export-Package . I want to get rid of them 
>>> completely. I tried several ways . If I try giving empty 
>>> Import-Package , it fails at build. I tried blank _exportcontents, 
>>> does not work too !
>>>
>>> Any clue ?
>>
>> I don't believe it should ever export anything by default, so if it 
>> is exporting it seems you must be telling it to do so somehow. On the 
>> other hand, it imports everything not included in the bundle by 
>> default. Not importing anything at all is harder than you might 
>> think. If you need any of the OSGi API then you need to import those 
>> packages; if you use any of the javax packages then you need to 
>> import them. But specifying !* should not import anything.
>>
>> -> richard
>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Getting rid of Import-Package and Export-Package

Posted by Sudhir Dharmadhikari <sd...@verient.com>.
Hi Richard - Thanks for your inputs. It worked using !*. As per 
documentation, it should export all classes and it is. Right now, no 
other bundle will use any exported packages from my bundle , so I wanted 
to get rid of this header at all from manifest . Similarly, there are 
hundreds of entries in Import-Package but none of them is needed . So I 
am disabling it as you suggested. That worked, but it created new header 
Ignore-Package and ignored all the one which were getting included. Just 
in case you wanted to see my configuration..

Here is my code,
         <plugin>
              <groupId>org.apache.felix</groupId>
              <artifactId>maven-bundle-plugin</artifactId>
              <extensions>true</extensions>
              <version>2.1.0</version>
              <configuration>   
                <instructions>               
                      
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
                    
<Bundle-ClassPath>{maven-dependencies},.</Bundle-ClassPath>
                    <Embed-Transitive>true</Embed-Transitive>
                    
<Bundle-RequiredExecutionEnvironment>JavaSE-1.6</Bundle-RequiredExecutionEnvironment>
                    <Bundle-Activator>osgi.Activator</Bundle-Activator>
                    
<Require-Bundle>org.eclipse.osgi;bundle-version="3.5.2"</Require-Bundle>
                    <Import-Package>!*</Import-Package>
                    <Export-Package>!*</Export-Package>                 
                </instructions>
              </configuration>                   
    </plugin>


Richard S. Hall wrote:
>  On 7/20/10 1:20, Sudhir Dharmadhikari wrote:
>> I am trying simple osgi bundle which has every dependency embedded 
>> inside my bundle. By default, bundle-plugin creates several entries 
>> in Import-Package and Export-Package . I want to get rid of them 
>> completely. I tried several ways . If I try giving empty 
>> Import-Package , it fails at build. I tried blank _exportcontents, 
>> does not work too !
>>
>> Any clue ?
>
> I don't believe it should ever export anything by default, so if it is 
> exporting it seems you must be telling it to do so somehow. On the 
> other hand, it imports everything not included in the bundle by 
> default. Not importing anything at all is harder than you might think. 
> If you need any of the OSGi API then you need to import those 
> packages; if you use any of the javax packages then you need to import 
> them. But specifying !* should not import anything.
>
> -> richard
>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Getting rid of Import-Package and Export-Package

Posted by "Richard S. Hall" <he...@ungoverned.org>.
  On 7/20/10 1:20, Sudhir Dharmadhikari wrote:
> I am trying simple osgi bundle which has every dependency embedded 
> inside my bundle. By default, bundle-plugin creates several entries in 
> Import-Package and Export-Package . I want to get rid of them 
> completely. I tried several ways . If I try giving empty 
> Import-Package , it fails at build. I tried blank _exportcontents, 
> does not work too !
>
> Any clue ?

I don't believe it should ever export anything by default, so if it is 
exporting it seems you must be telling it to do so somehow. On the other 
hand, it imports everything not included in the bundle by default. Not 
importing anything at all is harder than you might think. If you need 
any of the OSGi API then you need to import those packages; if you use 
any of the javax packages then you need to import them. But specifying 
!* should not import anything.

-> richard

>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org