1

I am developing Node.js script to install Eclipse plugins by using Eclipse built-in p2 director application. And p2-director fails to update features in some cases.

D:\Workspaces\Nodeclipse-DEV\nodeclipse-1\org.nodeclipse.ui\templates>node nodeclipse-install.js install -repository jar:file:/D:/Workspaces/Nodeclipse-DEV/nodeclipse-1/org.nodeclipse.site/target/org.nodeclipse.site-0.10.0-SNAPSHOT.zip!/ maven
Nodeclipse CLI Installer (Eclipse Plugin Manager epm)
starting eclipsec -nosplash -application org.eclipse.equinox.p2.director -repository jar:file:/D:/Workspaces/Nodeclipse-DEV/nodeclipse-1/org.nodeclipse.site/target/org.nodeclipse.site-0.10.0-SNAPSHOT.zip!/ -installIU org.nodeclipse.enide.maven.feature.feature.group -tag org.nodeclipse.enide.maven.feature.feature.group -vmargs -Declipse.p2.mirrors=false
Installing org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402180840.

Installation failed.

Cannot complete the install because of a conflicting dependency.
 Software being installed: Enide Maven 0.10.0.201402180840 (org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402180840)
 Software currently installed: Enide Maven 0.10.0.201402170319 (org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402170319)
 Only one of the following can be installed at once:
  Enide Maven 0.10.0.201402180840 (org.nodeclipse.enide.maven.feature.feature.jar 0.10.0.201402180840)
  Enide Maven 0.10.0.201402170319 (org.nodeclipse.enide.maven.feature.feature.jar 0.10.0.201402170319)
 Cannot satisfy dependency:
  From: Enide Maven 0.10.0.201402170319 (org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402170319)
  To: org.nodeclipse.enide.maven.feature.feature.jar [0.10.0.201402170319]
 Cannot satisfy dependency:
  From: Enide Maven 0.10.0.201402180840 (org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402180840)
  To: org.nodeclipse.enide.maven.feature.feature.jar [0.10.0.201402180840]
Application failed, log file location: E:\Eclipse\Enide-Studio-2014-try2-win64\eclipse\configuration\1392717353881.log

eclipsec process exit code 13

I also tried passing both .feature.jar and feature.group.

eclipsec -nosplash -application org.eclipse.equinox.p2.director -repository jar:file:/D:/Workspaces/Nodeclipse-DEV/nodeclipse-1/org.nodeclipse.site/target/org.nodeclipse.site-0.10.0-SNAPSHOT.zip!/ -installIU org.nodeclipse.enide.maven.feature.feature.group -tag org.nodeclipse.enide.maven.feature.feature.group -vmargs -Declipse.p2.mirrors=false

This maybe related to the fact that .maven feature includes .maven and .common plugins. .common plugin is also used by other features.
However this also happens with other features, that have no shared dependencies. p2 director help page does not specify the logic nor gives references.

Paul Verest
  • 60,022
  • 51
  • 208
  • 332

1 Answers1

5

On the p2 director level, there is no 'update' operation. Instead, you need to tell the director to both 'uninstall' and 'install' the IU that you want to be updated:

eclipse -application org.eclipse.equinox.p2.director -uninstallIU org.nodeclipse.enide.maven.feature.feature.group -installIU org.nodeclipse.enide.maven.feature.feature.group -repository ...
oberlies
  • 11,503
  • 4
  • 63
  • 110
  • 2
    I wonder if plugin settings are preserved and if it will be atomic operation, i.e. if install fails, then uninstall should not be applied... – Paul Verest Feb 24 '14 at 15:14
  • 2
    p2 has commit/rollback logic, so operations should be atomic. – oberlies Feb 25 '14 at 12:03
  • You can update p2 feature (in any profile) using `IProvisioningAgent` and `org.eclipse.equinox.p2.operations.UpdateOperation` but it's not exposed as a command-line tool. – Jarek Przygódzki Aug 19 '15 at 12:43