# Building an Eclipse plugin
Note | Note that this feature is considered as experimental. It should work with a simple configuration but may not with 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.
This page describes how to build an Eclipse™ plugin with Apache Ivy™ and its OSGi™ capabilities. ## Quick setup In a few steps, we will set up a build to compile and package an Eclipse plugin. download this ivy.xml, this ivysettings.xml, this ivysettings.properties, this build.xml, and put them into your plugin folder in the `ivysettings.properties`, specify the location of the plugins folder of your Eclipse target in the `ivy.xml`, change the symbolic name declared in the extends element (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) 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:
    ant buildobr
You need to run that command only once. Or each time your target platform get modified. Then to resolve and build, just run:
    ant build
### Eclipse setup 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.xml` you just added and select "Add Ivy library" in the configuration panel of the `IvyDE` classpath container, as the settings file put `${workspace_loc:mypluginproject/ivysettings.xml}` click finish and your Eclipse project should build now.
Note | 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 `ant obrindex` at least one time.
## Details on the setup ### The repository 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 `target/repo-eclipse.xml`. 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.