From 6f7881b9213a7ff95812fa89e6c1e0f38c165bb2 Mon Sep 17 00:00:00 2001 From: JoelAdbu Date: Thu, 9 Jul 2026 19:50:06 +0200 Subject: [PATCH 1/4] #2140: - Fix detection and upgrade of manually installed just --- .../tools/ide/tool/LocalToolCommandlet.java | 10 ++++++---- .../com/devonfw/tools/ide/tool/just/Just.java | 17 +++++++++++++++++ .../tools/ide/tool/uv/UvBasedCommandlet.java | 7 ++++++- .../devonfw/tools/ide/tool/just/JustTest.java | 14 ++++++++++++++ 4 files changed, 43 insertions(+), 5 deletions(-) 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..85d051a70e 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,9 @@ public ToolInstallation installTool(ToolInstallRequest request) { String edition = toolEdition.edition(); VersionIdentifier resolvedVersion = cveCheck(request); installToolDependencies(request); - + var debug = requested.getEdition(); + var debug2 = getInstalledEdition(); + var debugTool = requested.getEdition().tool(); // cveCheck might have changed resolvedVersion so let us re-check... if (request.isAlreadyInstalled()) { return toolAlreadyInstalled(request); @@ -223,8 +225,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 +606,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..601e5cf965 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,20 @@ public String getPackageName() { return "rust-just"; } + @Override + protected String getInstalledToolName() { + return "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/main/java/com/devonfw/tools/ide/tool/uv/UvBasedCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/uv/UvBasedCommandlet.java index 0962ab1069..b259a5ea2a 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/uv/UvBasedCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/uv/UvBasedCommandlet.java @@ -76,7 +76,7 @@ protected VersionIdentifier computeInstalledVersion() { request.setProcessContext(pc); ProcessResult result = runPackageManager(request, true); if (result.isSuccessful()) { - String prefix = packageName + " v"; + String prefix = getInstalledToolName() + " v"; for (String line : result.getOut()) { if (line.startsWith(prefix)) { return VersionIdentifier.of(line.substring(prefix.length()).trim()); @@ -87,4 +87,9 @@ protected VersionIdentifier computeInstalledVersion() { result.log(IdeLogLevel.DEBUG); return null; } + + protected String getInstalledToolName() { + return getPackageName(); + } + } 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..e4140781ad 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 @@ -76,4 +76,18 @@ void testJustGetInstalledVersion(WireMockRuntimeInfo wireMockRuntimeInfo) { // assert assertThat(installedVersion).isEqualTo(VersionIdentifier.of("1.37.0")); } + + + @Test + void testJustUsesDifferentInstalledToolName() { + + // arrange + Just commandlet = new Just(new IdeTestContext()); + + // assert + assertThat(commandlet.getPackageName()).isEqualTo("rust-just"); + assertThat(commandlet.getInstalledToolName()).isEqualTo("just"); + } + + } From d550b019539963f3e5a515110a6b2624dc957624 Mon Sep 17 00:00:00 2001 From: JoelAdbu Date: Fri, 10 Jul 2026 10:29:20 +0200 Subject: [PATCH 2/4] #2140: - fix (just): supports upgrades from manually installed just --- .../tools/ide/tool/LocalToolCommandlet.java | 3 --- .../java/com/devonfw/tools/ide/tool/just/Just.java | 5 ----- .../tools/ide/tool/uv/UvBasedCommandlet.java | 7 +------ .../com/devonfw/tools/ide/tool/just/JustTest.java | 14 -------------- 4 files changed, 1 insertion(+), 28 deletions(-) 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 85d051a70e..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,9 +167,6 @@ public ToolInstallation installTool(ToolInstallRequest request) { String edition = toolEdition.edition(); VersionIdentifier resolvedVersion = cveCheck(request); installToolDependencies(request); - var debug = requested.getEdition(); - var debug2 = getInstalledEdition(); - var debugTool = requested.getEdition().tool(); // cveCheck might have changed resolvedVersion so let us re-check... if (request.isAlreadyInstalled()) { return toolAlreadyInstalled(request); 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 601e5cf965..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 @@ -26,11 +26,6 @@ public String getPackageName() { return "rust-just"; } - @Override - protected String getInstalledToolName() { - return "just"; - } - @Override protected String completeRequestOption(PackageManagerRequest request) { diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/uv/UvBasedCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/uv/UvBasedCommandlet.java index b259a5ea2a..0962ab1069 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/uv/UvBasedCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/uv/UvBasedCommandlet.java @@ -76,7 +76,7 @@ protected VersionIdentifier computeInstalledVersion() { request.setProcessContext(pc); ProcessResult result = runPackageManager(request, true); if (result.isSuccessful()) { - String prefix = getInstalledToolName() + " v"; + String prefix = packageName + " v"; for (String line : result.getOut()) { if (line.startsWith(prefix)) { return VersionIdentifier.of(line.substring(prefix.length()).trim()); @@ -87,9 +87,4 @@ protected VersionIdentifier computeInstalledVersion() { result.log(IdeLogLevel.DEBUG); return null; } - - protected String getInstalledToolName() { - return getPackageName(); - } - } 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 e4140781ad..798e1717e3 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 @@ -76,18 +76,4 @@ void testJustGetInstalledVersion(WireMockRuntimeInfo wireMockRuntimeInfo) { // assert assertThat(installedVersion).isEqualTo(VersionIdentifier.of("1.37.0")); } - - - @Test - void testJustUsesDifferentInstalledToolName() { - - // arrange - Just commandlet = new Just(new IdeTestContext()); - - // assert - assertThat(commandlet.getPackageName()).isEqualTo("rust-just"); - assertThat(commandlet.getInstalledToolName()).isEqualTo("just"); - } - - } From a38eb7b3b7ad940f0b9c8f8797e56c63a0738e90 Mon Sep 17 00:00:00 2001 From: JoelAdbu Date: Fri, 10 Jul 2026 13:40:19 +0200 Subject: [PATCH 3/4] #2140: - update uv test mock to support install options - adjust Just tests for --force installation --- cli/src/test/java/com/devonfw/tools/ide/tool/just/JustTest.java | 2 +- .../test/resources/ide-projects/uv/repository/uv/uv/default/uv | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 From 1a8c359089cb79e85c34524276ab55c8cf866dc7 Mon Sep 17 00:00:00 2001 From: JoelAdbu Date: Fri, 10 Jul 2026 13:45:53 +0200 Subject: [PATCH 4/4] #2140: - add changelog for issu --- CHANGELOG.adoc | 1 + 1 file changed, 1 insertion(+) 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].