[ 
https://issues.apache.org/jira/browse/FELIX-2991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13055620#comment-13055620
 ] 

Stuart McCulloch commented on FELIX-2991:
-----------------------------------------

You can use the bundleplugin to create a fragment that augments Export-Package 
as long as you have a (maven) dependency on the fragment host, however the 
fragment will then also include the classes from the exported package because 
of how bnd assembles the bundle (it assumes it's a standalone bundle). Ideally 
bnd would notice that these classes are already in the fragment host and not 
add them to the fragment, in which case everything would work as expected.

Until then the various workarounds are:

a) use the maven-jar-plugin with a handcrafted manifest

b) use the bundleplugin without the export instruction, but configure the 
maven-jar-plugin with a partial handcrafted manifest (just the specific entries 
you want to override). The bundleplugin will then merge the static + generated 
manifests in the final bundle.

c) use packaging "jar" and add a separate bundleplugin execution to generate 
the manifest, like below

   <plugin>
     <groupId>org.apache.felix</groupId>
     <artifactId>maven-bundle-plugin</artifactId>
     <executions>
       <execution>
         <goals>
           <goal>manifest</goal>
         </goals>
         <configuration>
           <instructions>
             <Export-Package>...</Export-Package>
             <Fragment-Host>...</Fragment-Host>
           </instructions>
         </configuration>
       </execution>
     </executions>
   </plugin>


> Allow the creating of fragments that populate Export-Package 
> -------------------------------------------------------------
>
>                 Key: FELIX-2991
>                 URL: https://issues.apache.org/jira/browse/FELIX-2991
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven Bundle Plugin
>            Reporter: Michael Van Geertruy
>            Assignee: Stuart McCulloch
>
> When using the maven-bundle-plugin to create fragments which add 
> export-packages to a host bundle, the maven-bundle-plugin considers all of 
> the export-packages as superfluous, does not add them to the fragment's 
> MANIFEST.MF file and fails to compile.  
> The specific case is when attempting to add exports to a bundle where 
> bnd-wrapping doesn't pick up all of the necessary packages. For example, when 
> executing this line in Karaf:
> osgi:install -s mvn:tibco/tibco-crypt/5.1.2
> The wrap command skips over a number of packages. So creation of a fragment 
> is necessary. However, the build fails for the above noted reason. The 
> work-around for this issue is to use the maven-jar-plugin to create the 
> fragment.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to