logo Maven Bundle Plugin

Provides a maven plugin that supports creating an OSGi bundle from the contents of the compilation classpath along with its resources and dependencies. Plus a zillion other features. The plugin uses the Bnd tool (http://www.aqute.biz/Code/Bnd)

homepage: felix.apache.org/components/bundle-plugin
fresh index:
last release: 1 month ago, first release: 6 years ago
packaging: maven-plugin
get this artifact from: smartics central
see this artifact on: search.maven.org


Display vulnerabilities (snyk): Vulnerability check

This chart shows how much is this artifact used as a dependency in other Maven artifacts in Central repository and GitHub:


select version:

Add this snippet into pom.xml inside tag <project><build><plugins>:




Switch to artifact.
goals:
bundle:ant

Generate Ant script to create the bundle (you should run ant:ant first).

bundle:baseline (phase: verify)

BND Baseline check between two bundles.

bundle:baseline-report (phase: site)

BND Baseline report.

bundle:bundle (phase: package)

Create an OSGi bundle from Maven project

bundle:bundleall (phase: package)

Build an OSGi bundle jar for all transitive dependencies.

bundle:clean (phase: clean)

Clean an OBR repository by finding and removing missing resources.

bundle:cleanVersions

Clean OSGi versions, ie convert a group of versions to OSGi format.

bundle:deploy (phase: deploy)

Deploys bundle details to a remote OBR repository (life-cycle goal)

bundle:deploy-file (phase: deploy)

Deploys bundle details to a remote OBR repository (command-line goal)

bundle:index

Index the content of a maven repository using OBR

bundle:install (phase: install)

Installs bundle details in the local OBR repository (life-cycle goal)

bundle:install-file (phase: install)

Installs bundle details in the local OBR repository (command-line goal)

bundle:instructions

Generate BND instructions for this project

bundle:manifest (phase: process-classes)

Generate an OSGi manifest for this project

bundle:remote-clean (phase: clean)

Clean a remote repository file. It just looks for every resources and check that pointed file exists.

bundle:verify (phase: verify)

Verifies OSGi bundle metadata contains valid entries. Supported checks in the current version: All packages declared in the Export-Package header are really included in the bundle.

bundle:wrap (phase: package)

Build an OSGi bundle jar for direct dependencies.

Often used code snippets:

<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <extensions>true</extensions>
  <configuration>
    <instructions>
      <Bundle-SymbolicName>
                            ${project.artifactId}
                        </Bundle-SymbolicName>
      <Import-Package>
                            org.apache.commons.logging.*; version="${import.package.version.commons.logging}",
                            *;resolution:=optional
                        </Import-Package>
      <Export-Package>
                            org.wso2.carbon.apimgt.rest.api.util.*;version="${carbon.apimgt.version}"
                        </Export-Package>
    </instructions>
  </configuration>
</plugin>
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <executions>
    <execution>
      <id>bundle-manifest</id>
      <phase>process-classes</phase>
      <goals>
        <goal>manifest</goal>
      </goals>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <extensions>true</extensions>
  <configuration>
    <instructions>
      <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
      <Bundle-Name>${project.artifactId}</Bundle-Name>
      <Export-Package>
                            org.wso2.carbon.apimgt.handlers.security.stub.*;version=${carbon.apimgt.version},
                        </Export-Package>
      <Import-Package>
                            !javax.xml.namespace,
                            javax.xml.namespace; version=0.0.0,
                            javax.servlet; version=2.4.0,
                            javax.servlet.http; version=2.4.0,
                            org.apache.axiom.*; version="${axiom.osgi.version.range}",
                            *;resolution:=optional
                        </Import-Package>
    </instructions>
  </configuration>
</plugin>
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <extensions>true</extensions>
  <configuration>
    <instructions>
      <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
      <Bundle-Name>${project.artifactId}</Bundle-Name>
      <Export-Package>
                            org.wso2.carbon.apimgt.statsupdate.stub.*;version="${carbon.apimgt.version}"
                        </Export-Package>
      <Import-Package>
                            !javax.xml.namespace,
                            javax.xml.namespace; version=0.0.0,
                            javax.servlet; version=2.4.0,
                            javax.servlet.http; version=2.4.0,
                            org.apache.axiom.*; version="${axiom.osgi.version.range}",
                            *;resolution:=optional
                        </Import-Package>
    </instructions>
  </configuration>
</plugin>
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <extensions>true</extensions>
  <configuration>
    <instructions>
      <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
      <Bundle-Name>${project.artifactId}</Bundle-Name>
      <Export-Package>
                            org.wso2.carbon.apimgt.tier.cache.stub.*;version=${carbon.apimgt.version},
                        </Export-Package>
      <Import-Package>
                            !javax.xml.namespace,
                            javax.xml.namespace; version=0.0.0,
                            javax.servlet; version=2.4.0,
                            javax.servlet.http; version=2.4.0,
                            org.apache.axiom.*; version="${axiom.osgi.version.range}",
                            *;resolution:=optional
                        </Import-Package>
    </instructions>
  </configuration>
</plugin>

© Jiri Pinkas 2015 - 2022. All rights reserved! Admin login To submit bugs / feature requests please use this github page
related: JavaVids | Top Java Blogs | Java školení
Apache and Apache Maven are trademarks of the Apache Software Foundation. The Central Repository is a service mark of Sonatype, Inc.