diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 918ac0f87e..9c152eea84 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -6,6 +6,7 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDE Release with new features and bugfixes: +* https://github.com/devonfw/IDEasy/issues/2140[#2140]: fix just install fails since already installed The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/47?closed=1[milestone 2026.07.002]. diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java index def9af76db..8176bf8943 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java @@ -167,7 +167,6 @@ public ToolInstallation installTool(ToolInstallRequest request) { String edition = toolEdition.edition(); VersionIdentifier resolvedVersion = cveCheck(request); installToolDependencies(request); - // cveCheck might have changed resolvedVersion so let us re-check... if (request.isAlreadyInstalled()) { return toolAlreadyInstalled(request); @@ -223,8 +222,8 @@ public ToolInstallation installTool(ToolInstallRequest request) { } /** - * Performs the installation of the {@link #getName() tool} by using {@link #installDownloadedToolPayload(ToolInstallRequest, Path, Path)} - * for tool-specific logic, backing up any existing installation, and writing the version file. + * Performs the installation of the {@link #getName() tool} by using {@link #installDownloadedToolPayload(ToolInstallRequest, Path, Path)} for tool-specific + * logic, backing up any existing installation, and writing the version file. *

* This method assumes that the version has already been resolved and dependencies installed. It handles the final steps of placing the tool into the * appropriate installation directory. @@ -604,7 +603,7 @@ protected Path findWrapper(String wrapperFileName) { public Path findBuildDescriptor(Path directory) { return null; } - + /** * @return Bash completion command for this tool or {@code null} if this tool does not provide Bash completion. */ diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/just/Just.java b/cli/src/main/java/com/devonfw/tools/ide/tool/just/Just.java index 5791e10e29..7a59f12168 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/just/Just.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/just/Just.java @@ -4,6 +4,7 @@ import com.devonfw.tools.ide.common.Tag; import com.devonfw.tools.ide.context.IdeContext; +import com.devonfw.tools.ide.tool.PackageManagerRequest; import com.devonfw.tools.ide.tool.uv.UvBasedCommandlet; /** @@ -25,4 +26,15 @@ public String getPackageName() { return "rust-just"; } + @Override + protected String completeRequestOption(PackageManagerRequest request) { + + if (PackageManagerRequest.TYPE_INSTALL.equals(request.getType())) { + return "--force"; + } + + return super.completeRequestOption(request); + } + + } diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/just/JustTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/just/JustTest.java index 798e1717e3..7021303221 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/just/JustTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/just/JustTest.java @@ -35,7 +35,7 @@ void testJustInstall(WireMockRuntimeInfo wireMockRuntimeInfo) { commandlet.install(); // assert - assertThat(context).logAtInfo().hasMessageContaining("uv tool install rust-just@"); + assertThat(context).logAtInfo().hasMessageContaining("uv tool install --force rust-just@"); assertThat(context).logAtSuccess().hasMessageContaining("Successfully installed just"); } diff --git a/cli/src/test/resources/ide-projects/uv/repository/uv/uv/default/uv b/cli/src/test/resources/ide-projects/uv/repository/uv/uv/default/uv index aaf7631934..1edd479bdd 100755 --- a/cli/src/test/resources/ide-projects/uv/repository/uv/uv/default/uv +++ b/cli/src/test/resources/ide-projects/uv/repository/uv/uv/default/uv @@ -9,7 +9,7 @@ if [ "$1" = "pip" ] && [ "$2" = "install" ]; then elif [ "$1" = "venv" ] && [ "$2" = "--python" ]; then cp -a repository/python/python/default project/software/.venv elif [ "$1" = "tool" ] && [ "$2" = "install" ]; then - echo "$3" >> "$TOOLS_DB" + echo "${!#}" >> "$TOOLS_DB" elif [ "$1" = "tool" ] && [ "$2" = "list" ]; then if [ -f "$TOOLS_DB" ]; then while IFS= read -r spec; do