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

Stuart McCulloch commented on FELIX-3238:
-----------------------------------------

BTW, the reason why the split-package directive on the Export-Package was not 
working was because the mbp adds ";-split-package:=merge-first" by default to 
the list of private (local) packages. To see this use "mvn clean install -X" on 
the example project and look for the Private-Package instruction sent to bnd 
under "BND Instructions".

So another solution with mbp-2.3.4 is to use:

          <instructions>
            <Bundle-SymbolicName>${project.name}</Bundle-SymbolicName>
            
<Bundle-Activator>org.coderthoughts.asciipics.Activator</Bundle-Activator>
            
<Export-Package>org.coderthoughts.asciipics.impl;-split-package:=first</Export-Package>
            
<Private-Package>org.coderthoughts.asciipics.*;-split-package:=first</Private-Package>
          </instructions>

ie. set the split-package directive on both instructions.

I've made some improvements to the default Export/Private-Package generator 
under r1207213 to make this easier to adapt in the future, so you can use:

          <instructions>
            <Bundle-SymbolicName>${project.name}</Bundle-SymbolicName>
            
<Bundle-Activator>org.coderthoughts.asciipics.Activator</Bundle-Activator>
            
<Export-Package>{local-packages};-split-package:=first</Export-Package>
            
<Private-Package>{local-packages};-split-package:=first</Private-Package>
          </instructions>

for situations where you want to add directives in a parent pom, but don't know 
what packages are available. (This basically expands the existing support for 
"{local-packages}" to include its use inside Private-Package.)

                
> Unable to filter out classes from identical package in a dependency
> -------------------------------------------------------------------
>
>                 Key: FELIX-3238
>                 URL: https://issues.apache.org/jira/browse/FELIX-3238
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven Bundle Plugin
>    Affects Versions: maven-bundle-plugin-2.3.5
>            Reporter: David Bosschaert
>            Priority: Minor
>
> I as part of a refactoring a project is moving some classes from a package 
> org.acme.foo from bundle A to a separate bundle B.
> Unfortunately its not possible to move all the classes to the separate bundle 
> so this introduces a split package. Both bundle A and bundle B export package 
> org.acme.foo.
> Bundle A has a maven dependency on bundle B.
> What happens at the moment with the Maven Bundle Plugin 2.3.4 (we can't use 
> 2.3.5 as it has FELIX-3058 ) is that all the classes from org.acme.foo that 
> exist in bundle B are copied into the resulting bundle A.
> Below the pom.xml of a test-setup that I created. Both the current project as 
> well as ascii-pics-api-bundle-mbp dependency contain the 
> org.coderthouhts.asciipics.impl package.
> <project xmlns="http://maven.apache.org/POM/4.0.0"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/maven-v4_0_0.xsd";>
>   <modelVersion>4.0.0</modelVersion>
>   <parent>
>     <groupId>org.coderthoughts</groupId>
>     <artifactId>ascii-pics-parent-mbp</artifactId>
>     <version>1.0.0-SNAPSHOT</version>
>   </parent>
>   <artifactId>ascii-pics-provider-bundle-mbp</artifactId>
>   <packaging>bundle</packaging>
>   
>   <dependencies>
>     <dependency>
>       <groupId>org.coderthoughts</groupId>
>       <artifactId>ascii-pics-api-bundle-mbp</artifactId>
>       <version>1.0.0</version>
>       <scope>provided</scope>
>     </dependency>
>     <dependency>
>       <groupId>org.osgi</groupId>
>       <artifactId>org.osgi.core</artifactId>
>       <version>4.2.0</version>
>       <scope>provided</scope>
>     </dependency>
>   </dependencies>
>   
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.felix</groupId>
>         <artifactId>maven-bundle-plugin</artifactId>
>         <extensions>true</extensions>
>         <configuration>
>           <instructions>
>             <Bundle-SymbolicName>${project.name}</Bundle-SymbolicName>
>             
> <Bundle-Activator>org.coderthoughts.asciipics.Activator</Bundle-Activator>
>             
> <Export-Package>org.coderthoughts.asciipics.impl;-split-package:=first</Export-Package>
>           </instructions>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
> </project>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to