• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 22241505980

20 Feb 2026 09:16PM UTC coverage: 70.656% (+0.2%) from 70.474%
22241505980

Pull #1710

github

web-flow
Merge 04e4bdacd into 379acdc9d
Pull Request #1710: #404: allow logging via SLF4J

4121 of 6440 branches covered (63.99%)

Branch coverage included in aggregate %.

10704 of 14542 relevant lines covered (73.61%)

3.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

63.46
cli/src/main/java/com/devonfw/tools/ide/commandlet/InstallCommandlet.java
1
package com.devonfw.tools.ide.commandlet;
2

3
import java.nio.file.Path;
4

5
import org.slf4j.Logger;
6
import org.slf4j.LoggerFactory;
7

8
import com.devonfw.tools.ide.cli.GraalVmHelper;
9
import com.devonfw.tools.ide.context.IdeContext;
10
import com.devonfw.tools.ide.property.ToolProperty;
11
import com.devonfw.tools.ide.property.VersionProperty;
12
import com.devonfw.tools.ide.tool.IdeasyCommandlet;
13
import com.devonfw.tools.ide.tool.ToolCommandlet;
14
import com.devonfw.tools.ide.tool.ToolEditionAndVersion;
15
import com.devonfw.tools.ide.tool.ToolInstallRequest;
16
import com.devonfw.tools.ide.tool.ToolInstallation;
17
import com.devonfw.tools.ide.version.VersionIdentifier;
18

19
/**
20
 * {@link Commandlet} to install a tool.
21
 *
22
 * @see ToolCommandlet#install()
23
 */
24
public class InstallCommandlet extends Commandlet {
25

26
  private static final Logger LOG = LoggerFactory.getLogger(InstallCommandlet.class);
4✔
27

28
  /** The tool to install. */
29
  public final ToolProperty tool;
30

31
  /** The optional version to set and install. */
32
  public final VersionProperty version;
33

34
  /**
35
   * The constructor.
36
   *
37
   * @param context the {@link IdeContext}.
38
   */
39
  public InstallCommandlet(IdeContext context) {
40

41
    super(context);
3✔
42
    addKeyword(getName());
4✔
43
    this.tool = add(new ToolProperty("", false, "tool"));
11✔
44
    this.version = add(new VersionProperty("", false, "version"));
11✔
45
  }
1✔
46

47
  @Override
48
  public String getName() {
49

50
    return "install";
2✔
51
  }
52

53
  @Override
54
  public boolean isIdeRootRequired() {
55

56
    return this.tool.getValueCount() > 0;
6!
57
  }
58

59
  @Override
60
  protected void doRun() {
61

62
    if (this.tool.getValueCount() == 0) {
4!
63
      IdeasyCommandlet ideasy = new IdeasyCommandlet(this.context);
×
64
      GraalVmHelper graalVmHelper = GraalVmHelper.get();
×
65
      if (graalVmHelper.isNativeImage()) {
×
66
        LOG.debug("Detected that IDEasy is running as graalvm native image...");
×
67
      } else {
68
        LOG.debug("Detected that IDEasy is running in JVM...");
×
69
      }
70
      Path cwd = graalVmHelper.getCwd();
×
71
      LOG.info("Installing IDEasy from {}", cwd);
×
72
      if (!this.context.isForceMode()) {
×
73
        this.context.askToContinue("Sub-command install without any further arguments will perform the initial installation of IDEasy.\n"
×
74
            + "Since this is typically not to be called manually, you may have forgotten to specify the tool to install as extra argument.\n"
75
            + "The current command will install IDEasy on your computer. Are you sure?");
76
      }
77
      ideasy.installIdeasy(cwd);
×
78
      ideasy.setupWindowsTerminal();
×
79
      return;
×
80
    }
81
    ToolCommandlet commandlet = this.tool.getValue();
5✔
82
    VersionIdentifier versionIdentifier = this.version.getValue();
5✔
83
    VersionIdentifier version = versionIdentifier;
2✔
84
    if (version == null) {
2✔
85
      version = commandlet.getConfiguredVersion();
3✔
86
    }
87
    ToolInstallRequest request = ToolInstallRequest.ofDirect();
2✔
88
    request.setRequested(new ToolEditionAndVersion(version));
6✔
89
    ToolInstallation installation = commandlet.install(request);
4✔
90
    if (versionIdentifier != null) {
2✔
91
      VersionIdentifier installedVersion = installation.resolvedVersion();
3✔
92
      if (!versionIdentifier.isPattern() || !versionIdentifier.matches(installedVersion)) {
7!
93
        versionIdentifier = installedVersion;
2✔
94
      }
95
      commandlet.setVersion(versionIdentifier, false);
4✔
96
    }
97
  }
1✔
98

99
  @Override
100
  public ToolCommandlet getToolForCompletion() {
101

102
    return this.tool.getValue();
5✔
103
  }
104
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc