Building a standard OSGi bundle

Note that this feature is considered as experimental. It should work with simple configuration but may not in complex ones. If you have any issue with that feature, you are welcomed to come discussed your use case on the ivy-user mailing list, or discuss about implementation issues or improvement you may have found on ant-dev.


This page describes how to build an OSGi™ bundle with Apache Ivy™. In this use case, we just basically want to compute a classpath to compile, optionaly one for testing too, and then publish our bundle in a OSGi aware repository.

In oder to produce OSGi metadata of suffient quality and to avoid maintaining them manually, the bnd tool will be used. The approach taken is then an "Ivy file first" approach. The dependencies will be specified in the ivy.xml file, the MANIFEST.MF being generated from the computed classpath.

Quick setup

In few steps, we will setup a build to compile and publish an OSGi bundle.

  1. download this ivy.xml, this ivysettings.xml, this build.xml, this bnd file, and put them into your project folder;
  2. in the, specify the location of the plugins folder of your Eclipse target;
  3. (optional) by default the build.xml is expecting the sources to be in the src folder. You may want to edit it if it is not the case
  4. (optional) if Ivy is not in Ant's classpath, get the jar of Apache Ivy and edit the build.xml accordingly (see the comments at the begining of the file)