Skip to content

Conversation

Copy link

Copilot AI commented Jul 15, 2025

This PR implements support for installing multiple versions of the same tool in parallel, addressing the need for projects that require different versions of tools like Java for different components (e.g., frontend vs backend).

Key Features

Environment Variables

  • EXTRA_«TOOL»_VERSION: Configures the version of the extra tool to install
  • EXTRA_«TOOL»_EDITION: Configures the edition of the extra tool (falls back to regular edition if not set)
  • EXTRA_«TOOL»_HOME: Automatically set to point to the extra tool installation

Installation Behavior

  • Extra tools are installed in $IDE_HOME/software/extra/«tool»
  • Extra tools are NOT added to PATH to avoid conflicts
  • Installation is triggered automatically when running ide install «tool» if EXTRA_«TOOL»_VERSION is configured
  • Warning is logged if extra version/edition is identical to regular version/edition

Example Usage

# Configure regular Java for backend
JAVA_VERSION=21.0.0
JAVA_EDITION=temurin

# Configure extra Java for frontend  
EXTRA_JAVA_VERSION=11.0.21
EXTRA_JAVA_EDITION=oracle

After running ide install java, both versions will be available:

  • Regular Java 21 in $IDE_HOME/software/java (in PATH)
  • Extra Java 11 in $IDE_HOME/software/extra/java (accessible via $EXTRA_JAVA_HOME)

Tool Support

  • Supported for most SDK tools (Java, Maven, Node.js, etc.)
  • Disabled for GraalVM (already uses extra path) and IDE tools (no parallel installation use case)

Implementation Details

Core Changes

  • EnvironmentVariables.java: Added methods to handle extra tool variables
  • LocalToolCommandlet.java: Added extra tool installation logic integrated with existing installation flow
  • Documentation: Updated variables.adoc and usage.adoc with examples and explanations

Testing

  • Comprehensive unit tests for all new functionality
  • Integration tests for real-world installation scenarios
  • All existing tests continue to pass (no regression)

Backward Compatibility

  • Fully backward compatible - existing installations work unchanged
  • No changes to user workflow - extra tools are installed automatically when configured
  • No impact on tools that don't use extra tool configuration

This implementation provides a clean solution for projects needing multiple tool versions while maintaining the simplicity and reliability of the existing IDEasy installation system.

Fixes #1298.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • mobeigi.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.10/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.10/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.10 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.10/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/IDEasy/IDEasy org.codehaus.plexus.classworlds.launcher.Launcher clean test -Dtest=LocalToolCommandletTest (dns block)
  • www.github.com
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/jacoco/org.jacoco.agent/0.8.13/org.jacoco.agent-0.8.13-runtime.jar=destfile=/home/REDACTED/work/IDEasy/IDEasy/cli/target/jacoco.exec -jar /home/REDACTED/work/IDEasy/IDEasy/cli/target/surefire/surefirebooter-20250715165244926_3.jar /home/REDACTED/work/IDEasy/IDEasy/cli/target/surefire 2025-07-15T16-52-44_846-jvmRun1 surefire-20250715165244926_1tmp surefire_0-20250715165244926_2tmp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI and others added 3 commits July 15, 2025 16:48
Co-authored-by: maybeec <1427255+maybeec@users.noreply.github.com>
Co-authored-by: maybeec <1427255+maybeec@users.noreply.github.com>
Co-authored-by: maybeec <1427255+maybeec@users.noreply.github.com>
Copilot AI changed the title [WIP] Support for extra tool Add support for extra tool installations to run multiple versions in parallel Jul 15, 2025
Copilot AI requested a review from maybeec July 15, 2025 16:56
@maybeec maybeec marked this pull request as ready for review July 15, 2025 19:39
@maybeec maybeec requested a review from Copilot July 15, 2025 20:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for installing and managing parallel “extra” versions of tools via new environment variables and extends the installation flow accordingly.

  • Introduces EXTRA_«TOOL»_{VERSION,EDITION,HOME} variables and documentation updates
  • Extends EnvironmentVariables and LocalToolCommandlet with extra-tool getters and installation logic
  • Adds unit and integration tests covering the new extra-tool functionality

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
documentation/variables.adoc Added table entries for EXTRA_«TOOL»_VERSION, _EDITION, and _HOME
documentation/usage.adoc Added “Working with multiple versions of the same tool” section
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java New methods for extra-tool paths, configuration, support checks, and installExtraTool logic
cli/src/main/java/com/devonfw/tools/ide/environment/EnvironmentVariables.java Default getters and static mappings for extra-tool variables
cli/src/test/java/com/devonfw/tools/ide/tool/ExtraToolTest.java Unit tests for extra-tool variable accessors
cli/src/test/java/com/devonfw/tools/ide/commandlet/ExtraToolInstallationTest.java Integration tests for extra-tool install scenarios
Comments suppressed due to low confidence (3)

documentation/variables.adoc:38

  • [nitpick] The formatting for the EXTRA_«TOOL»_HOME entry uses asterisks around the code, causing inconsistent styling with other table rows. Remove the surrounding * for uniform table formatting.
|*`EXTRA_«TOOL»_HOME`*|`$IDE_HOME/software/extra/«tool»`|Path to the extra installation of «tool» (set automatically when `EXTRA_«TOOL»_VERSION` is configured).

cli/src/test/java/com/devonfw/tools/ide/commandlet/ExtraToolInstallationTest.java:175

  • This test documents that extra tool installation should be skipped for unsupported tools, but it never invokes tool.install(...) nor asserts that the extra installation path is not created. Consider adding an install(false) call and verifying that getExtraToolPath() does not exist.
    // But extra tool installation should be skipped during install

cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java:361

  • [nitpick] It might be clearer to add a dedicated getExtraToolHomeVariable(tool) helper to EnvironmentVariables for consistency and to avoid constructing the variable name inline here.
    String extraHomeVar = "EXTRA_" + EnvironmentVariables.getToolVariablePrefix(this.tool) + "_HOME";

ToolInstallation extraInstallation = installTool(extraVersion, processContext, extraEdition);

// Create link to extra tool path
Path extraToolPath = getExtraToolPath();
Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getExtraToolPath() can return null if softwareExtraPath is not set in the context, leading to a potential NPE here. Consider adding a null check or ensuring softwareExtraPath is always initialized.

Suggested change
Path extraToolPath = getExtraToolPath();
Path extraToolPath = getExtraToolPath();
if (extraToolPath == null) {
this.context.error("Failed to install extra tool: extraToolPath is not set.");
return; // Exit the method to prevent further execution
}

Copilot uses AI. Check for mistakes.
@coveralls
Copy link
Collaborator

coveralls commented Jul 15, 2025

Pull Request Test Coverage Report for Build 16299443721

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 54 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.004%) to 68.45%

Files with Coverage Reduction New Missed Lines %
com/devonfw/tools/ide/environment/EnvironmentVariables.java 6 87.14%
com/devonfw/tools/ide/tool/LocalToolCommandlet.java 48 78.18%
Totals Coverage Status
Change from base Build 16117325700: 0.004%
Covered Lines: 8442
Relevant Lines: 11931

💛 - Coveralls

@hohwille hohwille moved this from 🆕 New to Team Review in IDEasy board Jul 22, 2025
@maybeec
Copy link
Member

maybeec commented Nov 19, 2025

This PR is being closed in favor of #1605 which implements the same functionality. The changes from this PR have been taken over to the new PR, but authorship has been adjusted to comply with CLA requirements. All code and tests from this PR have been preserved in the new implementation.

Thank you for your contribution!

@maybeec maybeec closed this Nov 19, 2025
@github-project-automation github-project-automation bot moved this from Team Review to ✅ Done in IDEasy board Nov 19, 2025
@maybeec maybeec deleted the copilot/fix-1298 branch November 19, 2025 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Support for extra tool version

4 participants