The Maven plugin allows Bundlor to be run from inside any Maven project.
The following procedure shows how to set up Bundlor inside of an existing Maven POM
file.
Add the SpringSource Enterprise Bundle Repository to the pom.xml
file.
<pluginRepositories> <pluginRepository> <id>com.springsource.repository.bundles.release</id> <name>SpringSource Enterprise Bundle Repository</name> <url>http://repository.springsource.com/maven/bundles/release</url> </pluginRepository> ... </pluginRepositories>
Use the bundlor
plugin, as shown in the following example. See
Section 4.3.2, “Maven Plugin Reference” for details about the parameters of the plugin.
<build> <plugins> <plugin> <groupId>com.springsource.bundlor</groupId> <artifactId>com.springsource.bundlor.maven</artifactId> <version>1.0.0.RELEASE</version> <executions> <execution> <id>bundlor</id> <goals> <goal>bundlor</goal> </goals> </execution> </executions> </plugin> ... </plugins> ... </build>
The following table lists all the elements that you can specify for the bundlor
Maven plugin.
Table 4.3. Elements
Attribute | Description | Required |
---|---|---|
bundleSymbolicName | The OSGi Bundle-SymbolicName for the resulting manifest | No - defaults to ${project.artifactId} |
bundleVersion | The OSGi Bundle-Version for the resulting manifest | No - defaults to ${project.version} |
enabled | Whether Bundlor should create a manifest | No - defaults to true |
failOnWarnings | Whether Bundlor should cause a build failure when there are warnings warnings about the resulting manifest | No - defaults to false |
inputPath | The path to the input to create a manifest for. This can either be a directory or a JAR file. | No - defaults to ${project.build.outputDirectory} |
manifestTemplatePath | The path to the manifest template. See Chapter 5, Manifest Templates for details. | No - defaults to ${basedir}/template.mf |
osgiProfilePath | The path to the OSGi profile. See Chapter 6, OSGI Profiles and Bundlor for details. | No |
outputPath |
The path to write the manifest to. This can either be a directory, a JAR file, or not specified.
If a directory is specified, the manifest will be written to
If a JAR file is specified, the manifest will be written as the manifest for that JAR file. | No - defaults to ${project.build.outputDirectory} |
propertiesPath | The path to a properties file used for substitution. See Section 5.3, “Specifying property placeholders” for details. | No |
Manifest templates can be optionally specified inline instead of as an external file using the
<manifestTemplate/>
element.
<execution> <id>bundlor</id> <goals> <goal>bundlor</goal> </goals> <configuration> <manifestTemplate> Bundle-ManifestVersion: 2 Bundle-Name: Bundlor Core Bundle-Vendor: SpringSource Inc. Bundle-SymbolicName: com.springsource.bundlor Bundle-Version: 0 </manifestTemplate> </configuration> </execution>
See Chapter 5, Manifest Templates for details.
OSGI profiles can be optionally specified inline instead of as an external file using the
<osgiProfile/>
element.
<execution> <id>bundlor</id> <goals> <goal>bundlor</goal> </goals> <configuration> <osgiProfile> org.osgi.framework.system.packages = \ javax.accessibility,\ javax.activation,\ javax.activation;version="1.1.0",\ javax.activity,\ javax.annotation,\ ... org.osgi.framework.bootdelegation = \ com_cenqua_clover,\ com.cenqua.*,\ com.yourkit.*,\ ... </osgiProfile> </configuration> </execution>
See Chapter 6, OSGI Profiles and Bundlor for details.
Property substitution values can be optionally specified inline instead of as an external file using the
<properties/>
element.
<project> ... <properties> <bundle.name>${project.name}</bundle.name> <bundle.version>2.0.0.RELEASE</bundle.version> </properties> ... </project>
See Section 5.3, “Specifying property placeholders” for details.
<project> ... <build> <plugins> <plugin> <groupId>com.springsource.bundlor</groupId> <artifactId>com.springsource.bundlor.maven</artifactId> <executions> <execution> <id>bundlor</id> <goals> <goal>bundlor</goal> </goals> </execution> </executions> </plugin> </plugins> </build> ... </project>
<project> ... <properties> <bundle.name>${project.name}</bundle.name> <bundle.version>2.0.0.RELEASE</bundle.version> </properties> ... <build> <plugins> <plugin> <groupId>com.springsource.bundlor</groupId> <artifactId>com.springsource.bundlor.maven</artifactId> <executions> <execution> <id>bundlor</id> <goals> <goal>bundlor</goal> </goals> </execution> </executions> </plugin> </plugins> </build> ... </project>