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

devonfw / IDEasy / 15820521557

23 Jun 2025 09:29AM UTC coverage: 67.793% (+0.05%) from 67.745%
15820521557

push

github

web-flow
#901: Add mvn wrapper detection (#1373)

Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>

3177 of 5088 branches covered (62.44%)

Branch coverage included in aggregate %.

8137 of 11601 relevant lines covered (70.14%)

3.08 hits per line

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

31.52
cli/src/main/java/com/devonfw/tools/ide/commandlet/StatusCommandlet.java
1
package com.devonfw.tools.ide.commandlet;
2

3
import java.nio.file.Files;
4
import java.nio.file.Path;
5

6
import com.devonfw.tools.ide.context.IdeContext;
7
import com.devonfw.tools.ide.environment.EnvironmentVariables;
8
import com.devonfw.tools.ide.git.GitContext;
9
import com.devonfw.tools.ide.migration.IdeMigrator;
10
import com.devonfw.tools.ide.os.SystemInfo;
11
import com.devonfw.tools.ide.step.Step;
12
import com.devonfw.tools.ide.tool.IdeasyCommandlet;
13
import com.devonfw.tools.ide.version.VersionIdentifier;
14

15
/**
16
 * {@link Commandlet} to print a status report about IDEasy.
17
 */
18
public class StatusCommandlet extends Commandlet {
19

20
  /**
21
   * The constructor.
22
   *
23
   * @param context the {@link IdeContext}.
24
   */
25
  public StatusCommandlet(IdeContext context) {
26

27
    super(context);
3✔
28
    addKeyword(getName());
4✔
29
  }
1✔
30

31
  @Override
32
  public String getName() {
33

34
    return "status";
2✔
35
  }
36

37
  @Override
38
  public void run() {
39
    Step step = this.context.newStep(true, "Show IDE_ROOT and IDE_HOME");
8✔
40
    step.run(this.context::logIdeHomeAndRootStatus);
9✔
41
    step = this.context.newStep(true, "Show online status");
8✔
42
    step.run(this::logOnlineStatus);
5✔
43

44
    if (this.context.getIdeHome() != null) {
4!
45
      step = this.context.newStep(true, "Show git status");
×
46
      step.run(this::logSettingsGitStatus);
×
47
      step = this.context.newStep(true, "Show legacy status");
×
48
      step.run(this::logSettingsLegacyStatus);
×
49
      step = this.context.newStep(true, "Show migration status");
×
50
      step.run(this::logMigrationStatus);
×
51
    }
52
    step = this.context.newStep(true, "Check for updates of IDEasy");
8✔
53
    step.run(this::checkForUpdate);
5✔
54
  }
1✔
55

56
  private void checkForUpdate() {
57
    new IdeasyCommandlet(this.context, null).checkIfUpdateIsAvailable();
8✔
58
    logSystemInfo();
2✔
59
  }
1✔
60

61
  private void logSystemInfo() {
62
    SystemInfo systemInfo = this.context.getSystemInfo();
4✔
63
    this.context.info("Your operating system is {}({})@{} [{}@{}]", systemInfo.getOs(), systemInfo.getOsVersion(), systemInfo.getArchitecture(),
24✔
64
        systemInfo.getOsName(), systemInfo.getArchitectureName());
7✔
65
  }
1✔
66

67
  private void logSettingsLegacyStatus() {
68
    EnvironmentVariables variables = this.context.getVariables();
×
69
    boolean hasLegacyProperties = false;
×
70
    while (variables != null) {
×
71
      Path legacyProperties = variables.getLegacyPropertiesFilePath();
×
72
      if (legacyProperties != null && Files.exists(legacyProperties)) {
×
73
        hasLegacyProperties = true;
×
74
        this.context.warning("Found legacy properties {}", legacyProperties);
×
75
      }
76
      variables = variables.getParent();
×
77
    }
×
78
    if (hasLegacyProperties) {
×
79
      this.context.warning(
×
80
          "Your settings are outdated and contain legacy configurations. Please consider upgrading your settings:\nhttps://github.com/devonfw/IDEasy/blob/main/documentation/settings.adoc#upgrade");
81
    }
82
  }
×
83

84
  private void logSettingsGitStatus() {
85
    Path settingsPath = this.context.getSettingsGitRepository();
×
86
    if (settingsPath == null) {
×
87
      if (this.context.getIdeHome() != null) {
×
88
        this.context.error("No settings repository was found.");
×
89
      }
90
    } else {
91
      GitContext gitContext = this.context.getGitContext();
×
92
      if (gitContext.isRepositoryUpdateAvailable(settingsPath, this.context.getSettingsCommitIdPath())) {
×
93
        if (!this.context.isSettingsRepositorySymlinkOrJunction()) {
×
94
          this.context.warning("Your settings are not up-to-date, please run 'ide update'.");
×
95
        }
96
      } else {
97
        this.context.success("Your settings are up-to-date.");
×
98
      }
99
      String branch = gitContext.determineCurrentBranch(settingsPath);
×
100
      this.context.debug("Your settings branch is {}", branch);
×
101
      if (!"master".equals(branch) && !"main".equals(branch)) {
×
102
        this.context.warning("Your settings are on a custom branch: {}", branch);
×
103
      }
104
    }
105
  }
×
106

107
  private void logOnlineStatus() {
108
    if (this.context.isOfflineMode()) {
4!
109
      this.context.warning("You have configured offline mode via CLI.");
×
110
    } else if (this.context.isOnline()) {
4✔
111
      this.context.success("You are online.");
5✔
112
    } else {
113
      this.context.warning("You are offline. Check your internet connection and potential proxy settings.");
4✔
114
    }
115
  }
1✔
116

117
  private void logMigrationStatus() {
118

119
    IdeMigrator migrator = new IdeMigrator();
×
120
    VersionIdentifier projectVersion = this.context.getProjectVersion();
×
121
    VersionIdentifier targetVersion = migrator.getTargetVersion();
×
122
    if (projectVersion.isLess(targetVersion)) {
×
123
      this.context.interaction("Your project is on IDEasy version {} and needs an update to version {}!\nPlease run 'ide update' to migrate your project",
×
124
          projectVersion, targetVersion);
125
    }
126
  }
×
127

128
  @Override
129
  public boolean isIdeRootRequired() {
130

131
    return false;
2✔
132
  }
133
}
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