Search code examples
eclipsemaventycho

Eclipse plugin with Maven dependencies for third party libraries


I am converting Subclipse to build with Eclipse Tycho and Maven.

Subclipse depends on a few third party JAR files that are not Eclipse plugins so do not exist in any p2 repository. Currently, I just include these in a lib folder within the plugin.

Since these JAR files do exist in Maven, I was hoping that by converting the plugins to build with Maven I could use Maven dependencies. IOW, the plugin would have a pom.xml where I used Maven dependencies to grab and include the third party jar's that have to be included in the plugin. Basically, it would just automate having to refresh what I include in the lib folder of the plugin.

Is this possible? I tried doing what I said above by when I build, I saw no sign that Maven/Tycho was trying to fetch the dependencies. I imagine it is because when the packaging is eclipse-plugin it looks solely at the Eclipse configuration files for the dependency information.

Thanks


Solution

  • To add plain (without OSGi metadata) jar files into your folder at biuild time, you can specify an <execution> of the maven-dependency-plugin to fetch them. However it will require to update your MANIFEST.MF Bundle-Classpath directive whenever a version changes.

    It's usually better to hunt for OSGi-able jars or to make an extra effort to package existing libs as OSGi bundles/p2 artifacts like Eclipse Orbit or JBoss Tools Locus do.