Building a standard OSGi bundle

Note

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 discuss your use case on the ivy-user mailing list, or discuss about implementation issues or improvement you may have found, on ant-dev.


TODO - WORK IN PROGRESS


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, optionally one for testing too, and then publish our bundle in a OSGi aware repository.

In order to produce OSGi metadata of sufficient 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.

  • download this ivy.xml, this ivysettings.xml, this build.xml, this bnd file, and put them into your project folder

  • in the ivysettings.properties, specify the location of the plugins folder of your Eclipse target

  • (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

  • (optional) if Ivy is not in Ant’s classpath, download the Ivy jar and edit the build.xml accordingly (see the comments at the beginning of the file)

To build the project, run:

ant build