One of my preocupation when writing code is to perform exactly the needed work and to have pieces of code as small as possible. All unnecessary “things” HAVE to be removed.
One of these “things” in Eclipse is plugin dependencies.
The first way to avoid adding useless dependencies is to uncheck the “Generate activator …” and “This plugin will make contribution to the UI” checkboxes when creating a new “Library plugin”.
“Library plugins” are plugins that do not contribute anything to the platform but just exposes some “library” code. For example a plugin encapsulating sqlite.jar (JDBC driver for sqlite database) is a library plugin. Such plugin doesn’t need an Activator so doesn’t need dependencies on any Eclipse plugin. A common mistake is to use the Activator only to access Eclipse logging service. Such plugins should just through exceptions to clients plugins instead of using Eclipse logging service in order to remove dependencies on Eclipse’s core classes.
The second way to remove unused dependencies for any plugin is to simply use the Wonderfull PDE ;o)
Just click on the find unused dependencies link and PDE will tell you what dependencies you can remove !!!
Remove all these dependencies will lead to a smaller (mainly in terms of disk space) application for RCP developers. For plateform plugins developers it will increase the probability that your bundle will be resolved on your client’s Eclipse installation.
Use the PDE tools and remove your unused dependencies !!!


Also, specifically for library plug-ins using the “Plug-in from existing JAR archives” new project wizard will take care of creating a lean mean library bundle.
Hi Sud,
Thanks for this info. I was not aware about this wizard
(
Manu
Hi!
This can’t be done blindly – if remove dependencies that PDE says are unused, I get errors that classes are indirectly required by other plugins yet are unavailable.
regards,
Vlad
Hi Vlad,
You are right, in the case you described the PDE seems not to be able to see that the dependencies are required (Can anyone confirm ?).
Nevertheless I think we should never reach such a situation. The plugin you depends on should reexport this kind of dependencies in order to hide it to clients plugin.
Manu
Hi,
I confirm that indirectly referenced plugins are removed by PDE. It seems that the dependency computation is based on the package import declarations.
In order to view a nice graph of your dependencies, have a look at this plugin:
http://blog.ianbull.com/2007/10/plug-in-dependency-visualization.html
It helped me several times.
[...] remove useless dependencies in all your [...]