Search code examples
javaeclipseivypdeivyde

How to add dependencies from Ivy to the Eclipse PDE Target Platform?


I can add in external OSGi bundles into my PDE project and I can get them to show up in the Target Platform (although I need to perform a reload once I have added a new one), I do this with a "lib" directory in each project.

As my project has become more sophisticated I require some Spring bundles, and I looked to Ivy (the Ivy DE plugin) to manage the dependencies for me. This did a great job of finding all the bundles that were needed which get added to the classpath.

The problem is that I also need to add them to the target platform and I cannot find a way to get the target platform to look at the Ivy dependencies.

A possible workaround is to copy the Ivy dependencies into my lib directory. I'm very new to Ivy and cannot see a way to get it to copy dependencies to a local directory (to do that would seem to defy the point of Ivy). I also looked at adding the Ivy cache to the target platform (a crazy idea) but Eclipse couldn't find all the bundles because of the cache's directory structure.


Solution

  • Ivy is primarily designed to be embedded within an ANT build. In such a case you could use the retrieve task to decide where to save files within your build workspace:

    <ivy:retrieve pattern="${dist.dir}/WEB-INF/lib/[artifact].[ext]" conf="runtime"/>
    

    I'm not an expert on the ivy Eclipse plugin and whether this functionality is available for pure Eclipse builds.