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

6 Responses to Useless Plugins Dependencies

  1. sud says:

    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. Manuel says:

    Hi Sud,

    Thanks for this info. I was not aware about this wizard :o (

    Manu

  3. Vlad says:

    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

  4. Manuel says:

    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

  5. scorreia says:

    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.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.