Managing dependencies of a Eclipse plug-in project using Maven

Viewed 51

I am trying to use Maven for managing the dependencies of my plug-in project. The dependencies are correctly stated in the POM.xml. Even though, I get the exception :

java.lang.NoClassDefFoundError

Is it the correct way for solving dependencies for an Eclipse plug-in project?

1 Answers

Eclipse plug-ins must use the Require-Bundle or Import-Package statements in the plug-in's MANIFEST.MF to specify their dependencies.

Plug-ins can only be dependent on other plug-ins.

If you want to use a jar which is not a plug-in it must be included in the plug-in and included in the Bundle-Classpath in the MANIFEST.MF. You will also have to update the build.properties file to include the jars in the plug-in build.

Example MANIFEST.MF extract that includes 3 jars in the plug-in:

Require-Bundle: greg.music.core;bundle-version="1.0.0",
 greg.music.resources;bundle-version="1.0.0",
 org.eclipse.core.runtime,
 javazoom.jlgui.basicplayer,
 org.eclipse.e4.core.services;bundle-version="2.0.100"
Bundle-ClassPath: .,
 lib/jogg-0.0.7.jar,
 lib/jorbis-0.0.15.jar,
 lib/vorbisspi1.0.2.jar
Import-Package: javax.annotation;version="1.0.0",
 javax.inject;version="1.0.0",
 org.eclipse.e4.core.di.annotations

Matching build.properties

source.. = src/
output.. = bin/
bin.includes = META-INF/,\
               .,\
               plugin.properties,\
               plugin.xml,\
               lib/jogg-0.0.7.jar,\
               lib/jorbis-0.0.15.jar,\
               lib/vorbisspi1.0.2.jar
Related