Programmatically install the Eclipse plugin from Eclipse?

I want to create an automatic installer for the Eclipse plugin (ie not through the "Update Manager"). My scenario is simple: the user closes Eclipse, deletes the loaded JAR in the dropins folder, starts Eclipse, and the rest of the process is automated.

In older versions of Eclipse, prior to the P2 era, Eclipse had a (still) class called InstallCommand that could be used to install pluings in the current working platform.

Although this still works in Eclipse 3.4 and 3.5, it does not behave correctly: it is most noticeable that the plugins installed in this way cannot be automatically removed (it is darkened).

JavaDoc claims that InstallCommand deprecated and should be replaced with the P2 alternative. However, I could not find a suitable tool for the job. There is a P2 Director , but it is designed to run as a standalone application from the command line. It can be called from within Eclipse, but for this it is not cut. For example, performance monitoring and error reporting do not work.

Does anyone know of a good alternative for this?

Thanks, Zviki

+6
eclipse eclipse-plugin p2
source share
3 answers

Drops seem very close to what you want, especially if they just load jars without associated metadata (i.e. metadata should be automatically generated).

You might consider defining a second area of โ€‹โ€‹falls to control yourself. Take a look at ProfileSynchronizer in org.eclipse.equinox.p2.reconciler.dropins, specifically the createProfileChangeRequest method. I expect the deletion behavior that you don't like is the result of adding the IInstallableUnit.PROP_PROFILE_LOCKED_IU property.

Separators are checked at startup, see p2.reconciler.dropins Activator.watchDropins (), you can do the same from your own package to see another folder.

+1
source share

I suggest deploying your plugin as an executable JAR. The installer in the JAR should request the Eclipse installation directory and unzip the plugin in the right place (plus a few more checks as necessary).

Optionally, add a small โ€œwatchdogโ€ plugin, which does not depend on a large number and simply checks the correct loading of your main plugin and displays a useful error message that the user can send you an email for support.

0
source share

According to information in error 311590 1 , referred to by InstallCommand deprecation comment, an alternative could be to use P2 2 , 3 operations.

0
source share

All Articles