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 Sewe <an...@codetrails.com> on 2016/07/07 14:38:09 UTC

[maven-bundle-plugin] No Import-Package for Export-Package generated

Hi,

I am using the maven-bundle-plugin 3.0.1 to create an OSGi bundle. May
Maven project has a packaging of "bundle" and the m-bundle-p generates a
MANIFEST.MF for me.

Alas, unlike what's described in the documentation, my exported packages
are *not* imported.

From the documentation [1]:

> Any exported packages are also imported by default, to ensure a 
> consistent class space.

and

> Additionally, it generates imports for every export to ensure package
> substitutability, which is very important when working with
> collaborating services.

I am not using any <instructions> except for <Bundle-DocURL> (IMHO,
${project.url} is a much better DocURL than
${project.organization.url}), so <Export-Package> and <Import-Package>
are using their default values.

Can someone please point out the mistake I am making here?

Best wishes,

Andreas

[1]
<https://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html>

-- 
Codetrails GmbH
The knowledge transfer company

Robert-Bosch-Str. 7, 64293 Darmstadt
Phone: +49-6151-276-7092
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940

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


Re: [maven-bundle-plugin] No Import-Package for Export-Package generated

Posted by Andreas Sewe <an...@codetrails.com>.
Hi Cristiano,

> about the non-existent Private-Package in the final manifest, I can see
> in your latest email that there are a explicity removeheaders tag:
> 
> -removeheaders=Include-Resource,Private-Package

yes, I realized this as well after the first mail. Hence I send the
second with the bnd dumped instructions.

> And about the not importing all the exported packages I can't see the
> reason...
> 
> perhaps you would like to test your bundle with the 3.1.0-SNAPSHOT that
> is using latest bndlib version.

Is this available in a snapshot repository somewhere? I couldn't find a
URl on the felix.apache.org website.

Best wishes,

Andreas

-- 
Codetrails GmbH
The knowledge transfer company

Robert-Bosch-Str. 7, 64293 Darmstadt
Phone: +49-6151-276-7092
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940

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


Re: [maven-bundle-plugin] No Import-Package for Export-Package generated

Posted by Cristiano Gavião <cv...@gmail.com>.
about the non-existent Private-Package in the final manifest, I can see 
in your latest email that there are a explicity removeheaders tag:

-removeheaders=Include-Resource,Private-Package


And about the not importing all the exported packages I can't see the 
reason...

perhaps you would like to test your bundle with the 3.1.0-SNAPSHOT that 
is using latest bndlib version.

regards,

Cristiano

On 08/07/2016 04:48, Andreas Sewe wrote:
> Andreas Sewe wrote:
>> Anyway, I deleted all custom <configuration>, which results in the
>> following effective POM for my child project:
>>
>>>        <plugins>
>>>          <plugin>
>>>            <groupId>org.apache.felix</groupId>
>>>            <artifactId>maven-bundle-plugin</artifactId>
>>>            <version>3.0.1</version>
>>>            <extensions>true</extensions>
>>>            <executions>
>>>              <execution>
>>>                <id>default-bundle</id>
>>>                <phase>package</phase>
>>>                <goals>
>>>                  <goal>bundle</goal>
>>>                </goals>
>>>              </execution>
>>>              <execution>
>>>                <id>default-install</id>
>>>                <phase>install</phase>
>>>                <goals>
>>>                  <goal>install</goal>
>>>                </goals>
>>>              </execution>
>>>              <execution>
>>>                <id>default-deploy</id>
>>>                <phase>deploy</phase>
>>>                <goals>
>>>                  <goal>deploy</goal>
>>>                </goals>
>>>              </execution>
>>>            </executions>
>>>          </plugin>
>> This results in the following MANIFEST.MF:
>>
>>> Export-Package: com.ctrlflow.aer.client.logback;uses:="ch.qos.logback.cl
>>>   assic.spi,ch.qos.logback.core,com.ctrlflow.aer.client.dto";version="2.0
>>>   .0"
>>> Import-Package: ch.qos.logback.classic.spi;version="[1.1,2)",ch.qos.logb
>>>   ack.core;version="[1.1,2)",com.ctrlflow.aer.client.dto;version="[2.0,3)
>>>   ",com.google.common.base;version="[17.0,18)",com.google.common.collect;
>>>   version="[17.0,18)",com.google.gson;version="[2.3,3)",org.apache.common
>>>   s.lang3;version="[3.3,4)",org.apache.http;version="[4.3,5)",org.apache.
>>>   http.client;version="[4.3,5)",org.apache.http.client.entity;version="[4
>>>   .3,5)",org.apache.http.client.fluent;version="[4.3,5)",org.apache.http.
>>>   entity;version="[4.3,5)",org.slf4j;version="[1.7,2)"
>> Oddly, there is no Private-Package header, even though my child project
>> has a package matching *.internal.*. Maybe that's a hint?
> And in case it helps, here's the dumped instructions (grep'ed for
> "Package"):
>
>> Export-Package=com.ctrlflow.aer.client.logback
>> -removeheaders=Include-Resource,Private-Package
>> Private-Package=com.ctrlflow.aer.client.logback,com.ctrlflow.aer.client.logback.internal
>> Import-Package=*
> Having all packages marked as Private-Package looks odd. Why is that?
>
> Best wishes,
>
> Andreas
>


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


Re: [maven-bundle-plugin] No Import-Package for Export-Package generated

Posted by Andreas Sewe <an...@codetrails.com>.
Andreas Sewe wrote:
> Anyway, I deleted all custom <configuration>, which results in the
> following effective POM for my child project:
> 
>>       <plugins>
>>         <plugin>
>>           <groupId>org.apache.felix</groupId>
>>           <artifactId>maven-bundle-plugin</artifactId>
>>           <version>3.0.1</version>
>>           <extensions>true</extensions>
>>           <executions>
>>             <execution>
>>               <id>default-bundle</id>
>>               <phase>package</phase>
>>               <goals>
>>                 <goal>bundle</goal>
>>               </goals>
>>             </execution>
>>             <execution>
>>               <id>default-install</id>
>>               <phase>install</phase>
>>               <goals>
>>                 <goal>install</goal>
>>               </goals>
>>             </execution>
>>             <execution>
>>               <id>default-deploy</id>
>>               <phase>deploy</phase>
>>               <goals>
>>                 <goal>deploy</goal>
>>               </goals>
>>             </execution>
>>           </executions>
>>         </plugin>
> 
> This results in the following MANIFEST.MF:
> 
>> Export-Package: com.ctrlflow.aer.client.logback;uses:="ch.qos.logback.cl
>>  assic.spi,ch.qos.logback.core,com.ctrlflow.aer.client.dto";version="2.0
>>  .0"
>> Import-Package: ch.qos.logback.classic.spi;version="[1.1,2)",ch.qos.logb
>>  ack.core;version="[1.1,2)",com.ctrlflow.aer.client.dto;version="[2.0,3)
>>  ",com.google.common.base;version="[17.0,18)",com.google.common.collect;
>>  version="[17.0,18)",com.google.gson;version="[2.3,3)",org.apache.common
>>  s.lang3;version="[3.3,4)",org.apache.http;version="[4.3,5)",org.apache.
>>  http.client;version="[4.3,5)",org.apache.http.client.entity;version="[4
>>  .3,5)",org.apache.http.client.fluent;version="[4.3,5)",org.apache.http.
>>  entity;version="[4.3,5)",org.slf4j;version="[1.7,2)"
> 
> Oddly, there is no Private-Package header, even though my child project
> has a package matching *.internal.*. Maybe that's a hint?

And in case it helps, here's the dumped instructions (grep'ed for
"Package"):

> Export-Package=com.ctrlflow.aer.client.logback
> -removeheaders=Include-Resource,Private-Package
> Private-Package=com.ctrlflow.aer.client.logback,com.ctrlflow.aer.client.logback.internal
> Import-Package=*

Having all packages marked as Private-Package looks odd. Why is that?

Best wishes,

Andreas

-- 
Codetrails GmbH
The knowledge transfer company

Robert-Bosch-Str. 7, 64293 Darmstadt
Phone: +49-6151-276-7092
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940

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


Re: [maven-bundle-plugin] No Import-Package for Export-Package generated

Posted by Andreas Sewe <an...@codetrails.com>.
Hi Cristiano,

> It always help me to find generation problems looking the plugin
> declaration using the *effective POM*.
> If you use Eclipse IDE, you can use the one provided by m2e's POM editor.

yes, I had a look at the output of mvn help:effective-pom, but saw no
surprises there, as it's just my parent POM configuring the m-bundle-p
in its <pluginManagement> and my child POM having a packaging of "bundle".

Anyway, I deleted all custom <configuration>, which results in the
following effective POM for my child project:

>       <plugins>
>         <plugin>
>           <groupId>org.apache.felix</groupId>
>           <artifactId>maven-bundle-plugin</artifactId>
>           <version>3.0.1</version>
>           <extensions>true</extensions>
>           <executions>
>             <execution>
>               <id>default-bundle</id>
>               <phase>package</phase>
>               <goals>
>                 <goal>bundle</goal>
>               </goals>
>             </execution>
>             <execution>
>               <id>default-install</id>
>               <phase>install</phase>
>               <goals>
>                 <goal>install</goal>
>               </goals>
>             </execution>
>             <execution>
>               <id>default-deploy</id>
>               <phase>deploy</phase>
>               <goals>
>                 <goal>deploy</goal>
>               </goals>
>             </execution>
>           </executions>
>         </plugin>

This results in the following MANIFEST.MF:

> Export-Package: com.ctrlflow.aer.client.logback;uses:="ch.qos.logback.cl
>  assic.spi,ch.qos.logback.core,com.ctrlflow.aer.client.dto";version="2.0
>  .0"
> Import-Package: ch.qos.logback.classic.spi;version="[1.1,2)",ch.qos.logb
>  ack.core;version="[1.1,2)",com.ctrlflow.aer.client.dto;version="[2.0,3)
>  ",com.google.common.base;version="[17.0,18)",com.google.common.collect;
>  version="[17.0,18)",com.google.gson;version="[2.3,3)",org.apache.common
>  s.lang3;version="[3.3,4)",org.apache.http;version="[4.3,5)",org.apache.
>  http.client;version="[4.3,5)",org.apache.http.client.entity;version="[4
>  .3,5)",org.apache.http.client.fluent;version="[4.3,5)",org.apache.http.
>  entity;version="[4.3,5)",org.slf4j;version="[1.7,2)"

Oddly, there is no Private-Package header, even though my child project
has a package matching *.internal.*. Maybe that's a hint?

Any help is greatly appreciated.

Best wishes,

Andreas

-- 
Codetrails GmbH
The knowledge transfer company

Robert-Bosch-Str. 7, 64293 Darmstadt
Phone: +49-6151-276-7092
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940

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


Re: [maven-bundle-plugin] No Import-Package for Export-Package generated

Posted by Cristiano Gavião <cv...@gmail.com>.
Hi,
It always help me to find generation problems looking the plugin 
declaration using the *effective POM*.
If you use Eclipse IDE, you can use the one provided by m2e's POM editor.

It is useful because it will show you a merge of the local plugin 
configuration plus values coming from the pluginManagement and also the 
ones inherited from parent POMs.

perhaps there are some configuration error that you are not seeing.

regards,

Cristiano

On 07/07/2016 11:38, Andreas Sewe wrote:
> Hi,
>
> I am using the maven-bundle-plugin 3.0.1 to create an OSGi bundle. May
> Maven project has a packaging of "bundle" and the m-bundle-p generates a
> MANIFEST.MF for me.
>
> Alas, unlike what's described in the documentation, my exported packages
> are *not* imported.
>
>  From the documentation [1]:
>
>> Any exported packages are also imported by default, to ensure a
>> consistent class space.
> and
>
>> Additionally, it generates imports for every export to ensure package
>> substitutability, which is very important when working with
>> collaborating services.
> I am not using any <instructions> except for <Bundle-DocURL> (IMHO,
> ${project.url} is a much better DocURL than
> ${project.organization.url}), so <Export-Package> and <Import-Package>
> are using their default values.
>
> Can someone please point out the mistake I am making here?
>
> Best wishes,
>
> Andreas
>
> [1]
> <https://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html>
>