VMware offers training and certification to turbo-charge your progress.Learn more
In an earlier blog, Ben introduced Bundlor, the concepts behind it and how to use it from the command line as well as from within ANT and Maven. In this post I'll show how Bundlor can be used in an Eclipse environment.
When developing OSGi-based applications, some users don't want to spend time constantly updating their MANIFEST.MF, but instead want to focus on actual business logic in their application components: in such a scenario the Bundlor Eclipse integration will ensure that the MANIFEST.MF file reflects actual dependencies expressed by code artifacts in the project and removes the need to manually manage classpath settings in Eclipse. Additionally BundlorEclipse can help to cleanly separate runtime dependencies from test dependencies by introducing test-only source folders in Eclipse and a second manifest file called TEST.MF to specify dependencies of your unit test classes.
If Bundlor runs within Eclipse, it will use source code scanning based on Abstract Syntax Trees created with Eclipse JDT to process Java source files. This allows Bundlor to create manifest files without an existing project classpath and from non-compiling, partial Java code. Additionally all other resources supported by Bundlor (currently Spring configuration files, Hibernate and JPA mapping files) are also processed within Eclipse.
When used inside Eclipse, Bundlor supports incremental creation and updating of manifest files. This is useful during development when only a set of source code artifacts has changed. Bundlor will then only update those header values that belong to the changed resources instead of re-processing the complete project.
If you don't want to have Bundlor running in the background to automatically update the manifest on resource changes or you want to have more control over when the manifest should be updated, the Eclipse integration provides an action that launches Bundlor on-demand.
In addition to generating the main MANIFEST.MF, BundlorEclipse is also capable of creating a TEST.MF for pure test dependencies. To support this, source folders in an Eclipse Java project can be marked as being test-only. Bundlor will then process those test-only folders and add the detected dependencies to a TEST.MF.
BundlorEclipse can be used on any Eclipse Java project that has the SpringSource OSGi Bundle project nature. Please note that this does not require using the Bundle Classpath Container.
To test Bundlor you can create a new project with the New Bundle Project Wizard. The wizard will ensure that all prerequisites to run Bundlor are met. If you want to use or test Bundlor on an existing project go through the following steps:
BundlorEclipse can be used together with the Bundle Classpath Container from the dm Server Tools. The classpath container can be enabled and disabled from the context menu of any OSGi bundle project. In this setup the container will automatically update the classpath when the MANIFEST.MF or TEST.MF files have been changed by Bundlor. A typical developer workflow can look as follows:
Steps 4 to 6 will only execute if a dependency has been added or removed from the source code artifact or the source code artifact itself has been removed/moved.
Certainly BundlorEclipse can be used alongside any other classpath container (e.g. Maven Classpath Container): if you want to use a Maven plugin, like m2eclipse or Q4E, you can remove the Bundle Classpath Container (Spring Tools -> Disable Bundle Classpath Container) and enable the Maven support for the project. In this Artifact-First approach, Bundlor will only manage the MANIFEST.MF; the classpath will be controlled by the Maven plugin.
Please note that at this stage Bundlor does not have any synchronization features between detected dependencies, the MANIFEST.MF and a pom.xml: Bundlor will not automatically add detected dependencies to the pom.xml. This is on the product backlog and will very likely be addressed in a later release.
BundlorEclipse is available as part of the dm Server Tools 1.1.3.M1 which are licensed under the Eclipse Public License v1.0. You can install the dm Server Tools from our consolidated update site at:
If you encounter any problem please feel free to open a JIRA in the Bundlor project. As Bundlor and BundlorEclipse are new products we are happy to discuss those over at our dm Server Tools community forum.