DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
This plugin for Maven 2 is based on the BND tool from Peter Kriens. The way BND works is by treating your project as a big collection of classes (e.g., project code, dependencies, and the class path). The way you create a bundle with BND is to tell it the content of the bundle's JAR file as a subset of the available classes. This plugin wraps BND to make it work specifically with the Maven 2 project structure and to provide it with reasonable default behavior for Maven 2 projects.
NOTE: only compile, runtime and system scoped dependencies are passed to BND. Provided and test test scoped dependencies are not included in the classpath seen by BND.
...
<Bundle-SymbolicName>is computed using the shared Maven2OsgiConverter component, which uses the following algorithm:
Get the symbolic name as groupId + "." + artifactId, with the following exceptions:- if artifact.getFile is not null and the jar contains a OSGi Manifest with Bundle-SymbolicName property then that value is returned
- if groupId has only one section (no dots) and artifact.getFile is not null then the first package name with classes is returned. eg. commons-logging:commons-logging -> org.apache.commons.logging
- if artifactId is equal to last section of groupId then groupId is returned. eg. org.apache.maven:maven -> org.apache.maven
- if artifactId starts with last section of groupId that portion is removed. eg. org.apache.maven:maven-core -> org.apache.maven.core
The computed symbolic name is also stored in the$(maven-symbolicname)property in case you want to add attributes or directives to it.
<Export-Package>is now assumed to be the set of packages in your local Java sources, excluding the default package '.' and any packages containing 'impl' or 'internal'.
(before version 2 of the bundleplugin it was based on the symbolic name)<Private-Package>is now assumed to be the set of packages in your local Java sources (note that any packages in both<Export-Package>and<Private-Package>will be exported).
(before version 2 of the bundleplugin it was "<Bundle-SymbolicName>.*", unless<Private-Package>is specified, then<Export-Package>is assumed to be empty.<Private-Package>is assumed to be empty by default.)<Import-Package>is assumed to be "*", which imports everything referred to by the bundle content, but not contained in the bundle.<Include-Resource>is generated from the project's Maven resources, typically "src/main/resources/", which will copy the specified project directory hierarchy into the resulting bundle JAR file, mirroring standard Maven behavior.<Bundle-Version>is assumed to be "${pom.version}" with '-' character separator of the qualifier replaced with a '.' character.<Bundle-Name>is assumed to be "${pom.name}".<Bundle-Description>is assumed to be "${pom.description}".<Bundle-License>is assumed to be "${pom.licenses}".<Bundle-Vendor>is assumed to be "${pom.organization.name}".<Bundle-DocURL>is assumed to be "${pom.organization.url}".
...
| No Format |
|---|
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>my-osgi-bundles</groupId>
<artifactId>examplebundle</artifactId>
<packaging>bundle</packaging> <!-- (1) -->
<version>1.0</version>
<name>Example Bundle</name>
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin> <!-- (2) START -->
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>com.my.company.api</Export-Package>
<Private-Package>com.my.company.*</Private-Package>
<Bundle-Activator>com.my.company.Activator</Bundle-Activator>
</instructions>
</configuration>
</plugin> <!-- (2) END -->
</plugins>
</build>
</project>
|
...
bundle- build an OSGi bundle jar for the current project
configuration options:manifestLocationdefaults to ${project.build.outputDirectory}/META-INFunpackBundleunpack bundle contents to output directory, defaults to falseexcludeDependenciescomma-separated list of dependency artifactIds to exclude from the classpath passed to Bnd (, use "true" to exclude everything). Version 2 of the bundleplugin also supports the same style of filter clauses as Embed-Dependency.classifierattach bundle to the project using the given classifiersupportedProjectTypesdefaults to "jar","bundle"
...