Useless Plugins Dependencies

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”.

New Plugin Wizard Page 2

New Plugin Wizard Page 2

“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)

Find Unused Dependencies

Find Unused Dependencies

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 !!!

This entry was posted in Uncategorized by Manuel. Bookmark the permalink.

6 thoughts on “Useless Plugins Dependencies

  1. 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.

  2. 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.


  3. 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.


  4. Pingback: Build command line tools on top of Eclipse « Manuel Selva’s Eclipse blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s