diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 4e54f3ed6f..4d594d312f 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -20,6 +20,7 @@ Release with new features and bugfixes: * https://github.com/devonfw/IDEasy/issues/1853[#1853]: Add ARM releases for VSCode on Mac * https://github.com/devonfw/IDEasy/issues/797[#797]: Use system unzip on macOS to preserve symlinks in ZIP extraction * https://github.com/devonfw/IDEasy/issues/1723[#1723]: Add commandlet for GitHub Copilot CLI +* https://github.com/devonfw/IDEasy/issues/1880[#1880]: Reinstall all plugins for IDE in force mode * https://github.com/devonfw/IDEasy/issues/1685[#1685]: Add Nest CLI to IDEasy commandlets The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/44?closed=1[milestone 2026.05.001]. diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/PluginBasedCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/PluginBasedCommandlet.java index 75eec695b1..cd7fd2897c 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/PluginBasedCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/plugin/PluginBasedCommandlet.java @@ -110,17 +110,32 @@ protected void postInstall(ToolInstallRequest request) { Path pluginsInstallationPath = getPluginsInstallationPath(); FileAccess fileAccess = this.context.getFileAccess(); if (!request.isAlreadyInstalled()) { - fileAccess.delete(pluginsInstallationPath); + deleteAllPlugins(pluginsInstallationPath); + } else if (this.context.isForceMode()) { + // Prompt user if they want to reset all plugins + boolean resetPlugins = this.context.question( + "You are launching " + getName() + " in force mode. Do you want to reset all plugins for " + getName() + "? " + + "This will uninstall all currently installed plugins and reinstall them as configured in your IDEasy project settings."); + if (resetPlugins) { + deleteAllPlugins(pluginsInstallationPath); + } + } + fileAccess.mkdirs(pluginsInstallationPath); + installPlugins(request.getProcessContext()); + } + + private void deleteAllPlugins(Path pluginsInstallationPath) { + + FileAccess fileAccess = this.context.getFileAccess(); + fileAccess.delete(pluginsInstallationPath); List markerFiles = fileAccess.listChildren(this.context.getIdeHome().resolve(IdeContext.FOLDER_DOT_IDE), Files::isRegularFile); for (Path path : markerFiles) { if (path.getFileName().toString().startsWith("plugin." + getName())) { - LOG.debug("Plugin marker file {} got deleted.", path); fileAccess.delete(path); + LOG.debug("Plugin marker file {} got deleted.", path); } } - } - fileAccess.mkdirs(pluginsInstallationPath); - installPlugins(request.getProcessContext()); + } private void installPlugins(ProcessContext pc) { diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/eclipse/EclipseTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/eclipse/EclipseTest.java index d5b90fdeba..ba8e55af25 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/eclipse/EclipseTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/eclipse/EclipseTest.java @@ -34,7 +34,6 @@ void testEclipse(String os) throws IOException { SystemInfo systemInfo = SystemInfoMock.of(os); IdeTestContext context = newContext(PROJECT_ECLIPSE, "eclipseproject"); context.setSystemInfo(systemInfo); - context.getStartContext().setForceMode(true); // #663 Eclipse eclipse = context.getCommandletManager().getCommandlet(Eclipse.class); // act diff --git a/documentation/plugin.adoc b/documentation/plugin.adoc index fccd1dfd40..0cc2b623ff 100644 --- a/documentation/plugin.adoc +++ b/documentation/plugin.adoc @@ -30,3 +30,12 @@ For `VisualStudio Code`, this is the extension ID you can directly get from the |`active`|`true`|(optional) `true` to tell IDEasy that this plugin shall be installed automatically for everybody in your team. Default is `false`. If not auto-installed, it can still be installed via `ide install-plugin «ide» «plugin»`. |`tags`|e.g. `java,spring,ai`|(optional) Tags to classify the plugin. Will be used by the GUI of IDEasy for selection by tag. |=== + + +== Resetting installed plugins + +When first installing an IDE using `ide install «ide»`, IDEasy will automatically install all plugins that are configured in the project settings. +This configuration is intended to serve as a baseline for the entire team. +However, after the initial setup, you can freely change the plugin configuration for your IDE as you see fit. + +To revert to the initial plugin configuration, you can run `ide -f «ide»`, which will give you the option to uninstall all installed plugins and reinstall them as configured in your project settings.