Benny
Benny

Reputation: 1465

Apache Felix Maven Bundle Plugin avoid inlining of dependencies

How can I achieve that the plugin does not inline the dependencies in the new build jar file?

<build>
  <plugins>
   <plugin>
     <groupId>org.apache.felix</groupId>
     <artifactId>maven-bundle-plugin</artifactId>
     <extensions>true</extensions>
     <configuration>
       <instructions>
         <Bundle-Category>tools</Bundle-Category>
         <Fragment-Host>org.jsmpp.jsmpp</Fragment-Host>
         <Private-Package>!</Private-Package>
         <Export-Package>
           org.jsmpp.*;version="2.2.3"
         </Export-Package>
         <Import-Package>!org.slf4j</Import-Package>
         <Bundle-Version>2.2.3</Bundle-Version>
       </instructions>
     </configuration>
   </plugin>
  </plugins>
</build>
<dependencies>
  <dependency>
    <groupId>org.jsmpp</groupId>
    <artifactId>jsmpp</artifactId>
  </dependency>
</dependencies>

Upvotes: 1

Views: 1029

Answers (3)

J&#233;r&#233;mie B
J&#233;r&#233;mie B

Reputation: 11032

Use _exportcontents instead of Export-Package.

_exportcontents affect only the manifest, whereas Export-Package modify the manifest and the content of your bundle.

see: http://www.aqute.biz/Bnd/Format

Upvotes: 1

user3653004
user3653004

Reputation: 61

All packages that match the <Export-Package> instruction are included in the bundle, even if those packages come from a dependency. So you can either specify all packages from your bundle explicitly, or use a wildcard and exclude unwanted packages with the '!' prefix, e.g.

<Export-Package>
    org.jsmpp.*;version="2.2.3",
    !org.jsmpp.donotwant
</Export-Package>

see maven-bundle-plugin documentation

Upvotes: 0

Neil Bartlett
Neil Bartlett

Reputation: 23958

The plugin does not inline any dependencies, unless you include an Embed-Dependency instruction. That instruction can be inherited from a parent POM.

Upvotes: 1

Related Questions