- Documentation (2.5.0-rc1)
- Release Notes
- Settings Files
- Ivy Files
- Ant Tasks
- post resolve tasks
- Using standalone
- Developer doc
Building an Eclipse plugin
Note that this feature is considered as experimental.
This page describes how to build an Eclipse™ plugin with Apache Ivy™ and its OSGi™ capabilities.
In a few steps, we will set up a build to compile and package an Eclipse plugin.
ivysettings.properties, specify the location of the plugins folder of your Eclipse target
ivy.xml, change the symbolic name declared in the extends element
(optional) by default the
build.xmlis expecting the sources to be in the
srcfolder. 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.xmlaccordingly (see the comments at the beginning of the file)
And that’s it ! Now let’s use it.
First, Ivy needs to aggregate the OSGi metadata of the target platform. To do so just launch:
You need to run that command only once. Or each time your target platform get modified.
Then to resolve and build, just run:
You probably have already configured your project in Eclipse via the PDE. Let’s see how to change that and use Apache IvyDE:
First remove from your project’s classpath the PDE dependencies container
then right click on the
ivy.xmlyou just added and select "Add Ivy library"
in the configuration panel of the
IvyDEclasspath container, as the settings file put
click finish and your Eclipse project should build now.
For resolution to work correctly, Ivy relies on the aggregated metadata of your target platform. Even if you want to only build with Eclipse, you will have to run the command
Details on the setup
When building an Eclipse plugin, we are relying on a "target platform", the Eclipse installation we want our plugin to be eventually installed into. For Ivy, this will represent the repository of artifacts.
Ivy needs an aggregation of the OSGi metadata in order to resolve a such repository. The Ant task buildobr builds a OBR (OSGi Bundle Repository) descriptor file from a set of OSGi bundles. So here we are using this Ant task to gather OSGi metadata from the Eclipse plugins in the "target platform". In the above example, the file is built in
The plugin to be built has a
ivy.xml file describing its dependencies to be used by Ivy. Since the actual dependencies are in the
MANIFEST.MF file, in the
ivy.xml file we specify that it extends
META-INF/MANIFEST.MF. So there are few dependencies specified in the
ivy.xml. But as Ivy doesn’t support the
Bundle-Fragment OSGi feature, the
ivy.xml can help specify the missing dependencies.
Having this setup, it is then a standard Ant+Ivy build. Ivy computes the classpath to be used by the
javac tasks. Note that
javac is not aware of the OSGi metadata and is then incapable of failing to compile if private packages are accessed.