Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreWhen managing and transforming as many bundles as are included in the the SpringSource Enterprise Bundle Repository, it becomes very difficult to remember what packages are boot delegated, exported from the system bundle, or from other bundles in your system. This information is important because you probably don't want to import packages that are boot delegated, you probably do want to import system bundle packages at "0", and you want to define custom imports for all others. Remembering which packages are in each of these categories ends up being a bit error prone and defining template entries for them can be time-consuming.
With the release of 1.0.0.M4, Bundlor has gained the ability to take an OSGi profile as input and automatically add template entries for boot delegated packages and system bundles. This input is taken as a properties file and can be used with the command line, ANT, and Maven.
org.osgi.framework.system.packages
defines the packages exported from the system bundle and org.osgi.framework.bootdelegation
defines the packages that are boot delegated. For more information on the syntax of the values of these properties please see the OSGi specification §3.8.3 and §3.8.5.
For Bundlor, these properties are defined in a standard .properties file such as the following.
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.*,\
...
Bundle-SymbolicName: com.springsource.org.apache.log4j
Bundle-Name: Apache Log4J
Bundle-Vendor: SpringSource
Bundle-ManifestVersion: 2
Import-Template:
com.sun.jdmk.*;version="[5.1.0, 5.1.0]";resolution:=optional,
javax.jms.*;version="[1.1.0, 2.0.0)";resolution:=optional,
javax.mail.*;version="[1.4.0, 2.0.0)";resolution:=optional
When run against Bundlor without a profile I get the following warnings
SB0001W: The import of package javax.management does not specify a version.
SB0001W: The import of package javax.naming does not specify a version.
SB0001W: The import of package javax.swing does not specify a version.
SB0001W: The import of package javax.swing.border does not specify a version.
SB0001W: The import of package javax.swing.event does not specify a version.
SB0001W: The import of package javax.swing.table does not specify a version.
SB0001W: The import of package javax.swing.text does not specify a version.
SB0001W: The import of package javax.swing.tree does not specify a version.
SB0001W: The import of package javax.xml.parsers does not specify a version.
SB0001W: The import of package org.w3c.dom does not specify a version.
SB0001W: The import of package org.xml.sax does not specify a version.
SB0001W: The import of package org.xml.sax.helpers does not specify a version.
To satisfy these warnings, I could add a number of Import-Template
entries. Instead, I'll run Bundlor again with the dm Server OSGi profile. This profile exports each of these packages from the system bundle. This run returns with no warnings and imports each of these packages at version="0"
. This bundle did not depend on any package that is boot delegated so there are no ignore imports in our manifest.
osgiProfilePath
attribute.
<bundlor:bundlor
bundlePath="${basedir}/org.springframework.integration.jar"
outputPath="${basedir}/target/org.springframework.integration.jar"
bundleVersion="1.0.2.BUILD-${timestamp}"
osgiProfilePath="java6-server.profile"
manifestTemplatePath="${basedir}/template.mf"/>
osgiProfilePath
configuration.
<build>
<plugins>
<plugin>
<groupId>com.springsource.bundlor</groupId>
<artifactId>com.springsource.bundlor.maven</artifactId>
<version>1.0.0.M2</version>
<executions>
<execution>
<id>bundlor</id>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<osgiProfilePath>java6-server.profile</osgiProfilePath>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
...
</build>
-p, --profile
parameter for both the manifest
and transform
executions.
bin/bundlor.sh transform
-b com.springsource.org.apache.log4j.jar
-m com.springsource.org.apache.log4j.mf
-p java6-server.profile
The ability to read in an OSGi profile as input greatly simplifies content of manifest templates. If there are more areas that you can think of improvements, please open an issue or vote on an existing one at the Bundlor JIRA.