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

devonfw / IDEasy / 22284264868

22 Feb 2026 08:00PM UTC coverage: 70.75% (+0.3%) from 70.474%
22284264868

Pull #1714

github

web-flow
Merge 98f01421f into 379acdc9d
Pull Request #1714: #404: #1713: advanced logging

4063 of 6346 branches covered (64.02%)

Branch coverage included in aggregate %.

10636 of 14430 relevant lines covered (73.71%)

3.1 hits per line

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

77.78
cli/src/main/java/com/devonfw/tools/ide/context/IdeContext.java
1
package com.devonfw.tools.ide.context;
2

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

6
import com.devonfw.tools.ide.cli.CliAbortException;
7
import com.devonfw.tools.ide.cli.CliException;
8
import com.devonfw.tools.ide.cli.CliOfflineException;
9
import com.devonfw.tools.ide.commandlet.CommandletManager;
10
import com.devonfw.tools.ide.common.SystemPath;
11
import com.devonfw.tools.ide.environment.EnvironmentVariables;
12
import com.devonfw.tools.ide.environment.EnvironmentVariablesType;
13
import com.devonfw.tools.ide.environment.IdeSystem;
14
import com.devonfw.tools.ide.git.GitContext;
15
import com.devonfw.tools.ide.io.FileAccess;
16
import com.devonfw.tools.ide.io.IdeProgressBar;
17
import com.devonfw.tools.ide.io.IdeProgressBarNone;
18
import com.devonfw.tools.ide.log.IdeLogLevel;
19
import com.devonfw.tools.ide.merge.DirectoryMerger;
20
import com.devonfw.tools.ide.network.NetworkStatus;
21
import com.devonfw.tools.ide.os.SystemInfo;
22
import com.devonfw.tools.ide.os.WindowsPathSyntax;
23
import com.devonfw.tools.ide.process.ProcessContext;
24
import com.devonfw.tools.ide.step.Step;
25
import com.devonfw.tools.ide.tool.corepack.Corepack;
26
import com.devonfw.tools.ide.tool.custom.CustomToolRepository;
27
import com.devonfw.tools.ide.tool.gradle.Gradle;
28
import com.devonfw.tools.ide.tool.mvn.Mvn;
29
import com.devonfw.tools.ide.tool.mvn.MvnRepository;
30
import com.devonfw.tools.ide.tool.npm.Npm;
31
import com.devonfw.tools.ide.tool.npm.NpmRepository;
32
import com.devonfw.tools.ide.tool.pip.PipRepository;
33
import com.devonfw.tools.ide.tool.repository.ToolRepository;
34
import com.devonfw.tools.ide.url.model.UrlMetadata;
35
import com.devonfw.tools.ide.variable.IdeVariables;
36
import com.devonfw.tools.ide.version.IdeVersion;
37
import com.devonfw.tools.ide.version.VersionIdentifier;
38

39
/**
40
 * Interface for interaction with the user allowing to input and output information.
41
 */
42
public interface IdeContext extends IdeStartContext {
43

44
  /**
45
   * The default settings URL.
46
   *
47
   * @see com.devonfw.tools.ide.commandlet.AbstractUpdateCommandlet
48
   */
49
  String DEFAULT_SETTINGS_REPO_URL = "https://github.com/devonfw/ide-settings.git";
50

51
  /** The name of the workspaces folder. */
52
  String FOLDER_WORKSPACES = "workspaces";
53

54
  /** The name of the {@link #getSettingsPath() settings} folder. */
55
  String FOLDER_SETTINGS = "settings";
56

57
  /** The name of the {@link #getSoftwarePath() software} folder. */
58
  String FOLDER_SOFTWARE = "software";
59

60
  /** The name of the {@link #getUrlsPath() urls} folder. */
61
  String FOLDER_URLS = "urls";
62

63
  /** The name of the conf folder for project specific user configurations. */
64
  String FOLDER_CONF = "conf";
65

66
  /**
67
   * The name of the folder inside IDE_ROOT reserved for IDEasy. Intentionally starting with an underscore and not a dot to prevent effects like OS hiding,
68
   * maven filtering, .gitignore and to distinguish from {@link #FOLDER_DOT_IDE}.
69
   *
70
   * @see #getIdePath()
71
   */
72
  String FOLDER_UNDERSCORE_IDE = "_ide";
73

74
  /**
75
   * The name of the folder inside {@link #FOLDER_UNDERSCORE_IDE} with the current IDEasy installation.
76
   *
77
   * @see #getIdeInstallationPath()
78
   */
79
  String FOLDER_INSTALLATION = "installation";
80

81
  /**
82
   * The name of the hidden folder for IDE configuration in the users home directory or status information in the IDE_HOME directory.
83
   *
84
   * @see #getUserHomeIde()
85
   */
86
  String FOLDER_DOT_IDE = ".ide";
87

88
  /** The name of the updates folder for temporary data and backup. */
89
  String FOLDER_UPDATES = "updates";
90

91
  /** The name of the volume folder for mounting archives like *.dmg. */
92
  String FOLDER_VOLUME = "volume";
93

94
  /** The name of the backups folder for backup. */
95
  String FOLDER_BACKUPS = "backups";
96

97
  /** The name of the logs folder for log-files (in {@link #FOLDER_UNDERSCORE_IDE}). */
98
  String FOLDER_LOGS = "logs";
99

100
  /** The name of the downloads folder. */
101
  String FOLDER_DOWNLOADS = "Downloads";
102

103
  /** The name of the bin folder where executable files are found by default. */
104
  String FOLDER_BIN = "bin";
105

106
  /** The name of the repositories folder where properties files are stores for each repository */
107
  String FOLDER_REPOSITORIES = "repositories";
108

109
  /** The name of the repositories folder where properties files are stores for each repository */
110
  String FOLDER_LEGACY_REPOSITORIES = "projects";
111

112
  /** The name of the Contents folder inside a MacOS app. */
113
  String FOLDER_CONTENTS = "Contents";
114

115
  /** The name of the Resources folder inside a MacOS app. */
116
  String FOLDER_RESOURCES = "Resources";
117

118
  /** The name of the app folder inside a MacOS app. */
119
  String FOLDER_APP = "app";
120

121
  /** The name of the extra folder inside the software folder */
122
  String FOLDER_EXTRA = "extra";
123

124
  /**
125
   * The name of the {@link #getPluginsPath() plugins folder} and also the plugins folder inside the IDE folders of {@link #getSettingsPath() settings} (e.g.
126
   * settings/eclipse/plugins).
127
   */
128
  String FOLDER_PLUGINS = "plugins";
129

130
  /**
131
   * The name of the workspace folder inside the IDE specific {@link #FOLDER_SETTINGS settings} containing the configuration templates in #FOLDER_SETUP
132
   * #FOLDER_UPDATE.
133
   */
134
  String FOLDER_WORKSPACE = "workspace";
135

136
  /**
137
   * The name of the setup folder inside the {@link #FOLDER_WORKSPACE workspace} folder containing the templates for the configuration templates for the initial
138
   * setup of a workspace. This is closely related with the {@link #FOLDER_UPDATE update} folder.
139
   */
140
  String FOLDER_SETUP = "setup";
141

142
  /**
143
   * The name of the update folder inside the {@link #FOLDER_WORKSPACE workspace} folder containing the templates for the configuration templates for the update
144
   * of a workspace. Configurations in this folder will be applied every time the IDE is started. They will override the settings the user may have manually
145
   * configured every time. This is only for settings that have to be the same for every developer in the project. An example would be the number of spaces used
146
   * for indentation and other code-formatting settings. If all developers in a project team use the same formatter settings, this will actively prevent
147
   * diff-wars. However, the entire team needs to agree on these settings.<br> Never configure aspects inside this update folder that may be of personal flavor
148
   * such as the color theme. Otherwise developers will hate you as you actively take away their freedom to customize the IDE to their personal needs and
149
   * wishes. Therefore do all "biased" or "flavored" configurations in {@link #FOLDER_SETUP setup} so these are only pre-configured but can be changed by the
150
   * user as needed.
151
   */
152
  String FOLDER_UPDATE = "update";
153

154
  /**
155
   * The name of the folder inside {@link #FOLDER_UNDERSCORE_IDE _ide} folder containing internal resources and scripts of IDEasy.
156
   */
157
  String FOLDER_INTERNAL = "internal";
158

159
  /** The file where the installed software version is written to as plain text. */
160
  String FILE_SOFTWARE_VERSION = ".ide.software.version";
161

162
  /** The file where the installed software version is written to as plain text. */
163
  String FILE_LEGACY_SOFTWARE_VERSION = ".devon.software.version";
164

165
  /** The file for the license agreement. */
166
  String FILE_LICENSE_AGREEMENT = ".license.agreement";
167

168
  /** The file extension for a {@link java.util.Properties} file. */
169
  String EXT_PROPERTIES = ".properties";
170

171
  /** The default for {@link #getWorkspaceName()}. */
172
  String WORKSPACE_MAIN = "main";
173

174
  /** The folder with the configuration template files from the settings. */
175
  String FOLDER_TEMPLATES = "templates";
176

177
  /** Legacy folder name used as compatibility fallback if {@link #FOLDER_TEMPLATES} does not exist. */
178
  String FOLDER_LEGACY_TEMPLATES = "devon";
179

180
  /** The default folder name for {@link #getIdeRoot() IDE_ROOT}. */
181
  String FOLDER_PROJECTS = "projects";
182

183
  /**
184
   * file containing the current local commit hash of the settings repository.
185
   */
186
  String SETTINGS_COMMIT_ID = ".commit.id";
187

188
  /** The IDEasy ASCII logo. */
189
  String LOGO = """
4✔
190
      __       ___ ___  ___
191
      ╲ ╲     |_ _|   ╲| __|__ _ ____ _
192
       > >     | || |) | _|/ _` (_-< || |
193
      /_/ ___ |___|___/|___╲__,_/__/╲_, |
194
         |___|                       |__/
195
      """.replace('╲', '\\');
2✔
196

197
  /**
198
   * The keyword for project name convention.
199
   */
200
  String SETTINGS_REPOSITORY_KEYWORD = "settings";
201
  String IS_NOT_INSTALLED_BUT_REQUIRED = "is not installed on your computer but required by IDEasy.";
202
  String WINDOWS_GIT_DOWNLOAD_URL = "https://git-scm.com/download/";
203
  String PLEASE_DOWNLOAD_AND_INSTALL_GIT = "Please download and install git";
204

205
  /**
206
   * @return the {@link NetworkStatus} for online check and related operations.
207
   */
208
  NetworkStatus getNetworkStatus();
209

210
  /**
211
   * @return {@code true} if {@link #isOfflineMode() offline mode} is active or we are NOT {@link #isOnline() online}, {@code false} otherwise.
212
   * @deprecated use {@link #getNetworkStatus()}
213
   */
214
  default boolean isOffline() {
215

216
    return getNetworkStatus().isOffline();
4✔
217
  }
218

219
  /**
220
   * @return {@code true} if we are currently online (Internet access is available), {@code false} otherwise.
221
   * @deprecated use {@link #getNetworkStatus()}
222
   */
223
  default boolean isOnline() {
224

225
    return getNetworkStatus().isOnline();
×
226
  }
227

228
  /**
229
   * Print the IDEasy {@link #LOGO logo}.
230
   */
231
  default void printLogo() {
232

233
    AbstractIdeContext.LOG.info(LOGO);
3✔
234
  }
1✔
235

236
  /**
237
   * Asks the user for a single string input.
238
   *
239
   * @param message The information message to display.
240
   * @param defaultValue The default value to return when no input is provided or {@code null} to keep asking until the user entered a non empty value.
241
   * @return The string input from the user, or the default value if no input is provided.
242
   */
243
  String askForInput(String message, String defaultValue);
244

245
  /**
246
   * Asks the user for a single string input.
247
   *
248
   * @param message The information message to display.
249
   * @return The string input from the user.
250
   */
251
  default String askForInput(String message) {
252
    return askForInput(message, null);
5✔
253
  }
254

255
  /**
256
   * @param question the question to ask.
257
   * @param args arguments for filling the templates
258
   * @return {@code true} if the user answered with "yes", {@code false} otherwise ("no").
259
   */
260
  default boolean question(String question, Object... args) {
261

262
    String yes = "yes";
2✔
263
    String option = question(new String[] { yes, "no" }, question, args);
16✔
264
    if (yes.equals(option)) {
4!
265
      return true;
2✔
266
    }
267
    return false;
×
268
  }
269

270
  /**
271
   * @param <O> type of the option. E.g. {@link String}.
272
   * @param options the available options for the user to answer. There should be at least two options given as otherwise the question cannot make sense.
273
   * @param question the question to ask.
274
   * @return the option selected by the user as answer.
275
   */
276
  @SuppressWarnings("unchecked")
277
  <O> O question(O[] options, String question, Object... args);
278

279
  /**
280
   * Will ask the given question. If the user answers with "yes" the method will return and the process can continue. Otherwise if the user answers with "no" an
281
   * exception is thrown to abort further processing.
282
   *
283
   * @param questionTemplate the yes/no question to {@link #question(String, Object...) ask}.
284
   * @param args the arguments to fill the placeholders in the question template.
285
   * @throws CliAbortException if the user answered with "no" and further processing shall be aborted.
286
   */
287
  default void askToContinue(String questionTemplate, Object... args) {
288
    boolean yesContinue = question(questionTemplate, args);
5✔
289
    if (!yesContinue) {
2!
290
      throw new CliAbortException();
×
291
    }
292
  }
1✔
293

294
  /**
295
   * @param purpose the purpose why Internet connection is required.
296
   * @param explicitOnlineCheck if {@code true}, perform an explicit {@link #isOffline()} check; if {@code false} use {@link #isOfflineMode()}.
297
   * @throws CliException if you are {@link #isOffline() offline}.
298
   */
299
  default void requireOnline(String purpose, boolean explicitOnlineCheck) {
300

301
    if (explicitOnlineCheck) {
2✔
302
      if (isOffline()) {
3✔
303
        throw CliOfflineException.ofPurpose(purpose);
3✔
304
      }
305
    } else {
306
      if (isOfflineMode()) {
3!
307
        throw CliOfflineException.ofPurpose(purpose);
3✔
308
      }
309
    }
310
  }
1✔
311

312
  /**
313
   * @return the {@link SystemInfo}.
314
   */
315
  SystemInfo getSystemInfo();
316

317
  /**
318
   * @return the {@link EnvironmentVariables} with full inheritance.
319
   */
320
  EnvironmentVariables getVariables();
321

322
  /**
323
   * @return the {@link FileAccess}.
324
   */
325
  FileAccess getFileAccess();
326

327
  /**
328
   * @return the {@link CommandletManager}.
329
   */
330
  CommandletManager getCommandletManager();
331

332
  /**
333
   * @return the default {@link ToolRepository}.
334
   */
335
  ToolRepository getDefaultToolRepository();
336

337
  /**
338
   * @return the {@link CustomToolRepository}.
339
   */
340
  CustomToolRepository getCustomToolRepository();
341

342
  /**
343
   * @return the {@link MvnRepository}.
344
   */
345
  MvnRepository getMvnRepository();
346

347
  /**
348
   * @return the {@link NpmRepository}.
349
   */
350
  NpmRepository getNpmRepository();
351

352
  /**
353
   * @return the {@link PipRepository}.
354
   */
355
  PipRepository getPipRepository();
356

357
  /**
358
   * @return the {@link Path} to the IDE instance directory. You can have as many IDE instances on the same computer as independent tenants for different
359
   *     isolated projects.
360
   * @see com.devonfw.tools.ide.variable.IdeVariables#IDE_HOME
361
   */
362
  Path getIdeHome();
363

364
  /**
365
   * @return the name of the current project.
366
   * @see com.devonfw.tools.ide.variable.IdeVariables#PROJECT_NAME
367
   */
368
  String getProjectName();
369

370
  /**
371
   * @return the IDEasy version the {@link #getIdeHome() current project} was created with or migrated to.
372
   */
373
  VersionIdentifier getProjectVersion();
374

375
  /**
376
   * @param version the new value of {@link #getProjectVersion()}.
377
   */
378
  void setProjectVersion(VersionIdentifier version);
379

380
  /**
381
   * @return the {@link Path} to the IDE installation root directory. This is the top-level folder where the {@link #getIdeHome() IDE instances} are located as
382
   *     sub-folder. There is a reserved ".ide" folder where central IDE data is stored such as the {@link #getUrlsPath() download metadata} and the central
383
   *     software repository.
384
   * @see com.devonfw.tools.ide.variable.IdeVariables#IDE_ROOT
385
   */
386
  Path getIdeRoot();
387

388
  /**
389
   * @return the {@link Path} to the {@link #FOLDER_UNDERSCORE_IDE}.
390
   * @see #getIdeRoot()
391
   * @see #FOLDER_UNDERSCORE_IDE
392
   */
393
  Path getIdePath();
394

395
  /**
396
   * @return the {@link Path} to the {@link #FOLDER_INSTALLATION installation} folder of IDEasy. This is a link to the (latest) installed release of IDEasy. On
397
   *     upgrade a new release is installed and the link is switched to the new release.
398
   */
399
  default Path getIdeInstallationPath() {
400

401
    Path idePath = getIdePath();
3✔
402
    if (idePath == null) {
2!
403
      return null;
×
404
    }
405
    return idePath.resolve(FOLDER_INSTALLATION);
4✔
406
  }
407

408
  /**
409
   * @return the current working directory ("user.dir"). This is the directory where the user's shell was located when the IDE CLI was invoked.
410
   */
411
  Path getCwd();
412

413
  /**
414
   * @return the {@link Path} for the temporary directory to use. Will be different from the OS specific temporary directory (java.io.tmpDir).
415
   */
416
  Path getTempPath();
417

418
  /**
419
   * @return the {@link Path} for the temporary download directory to use.
420
   */
421
  Path getTempDownloadPath();
422

423
  /**
424
   * @return the {@link Path} to the download metadata (ide-urls). Here a git repository is cloned and updated (pulled) to always have the latest metadata to
425
   *     download tools.
426
   * @see com.devonfw.tools.ide.url.model.folder.UrlRepository
427
   */
428
  Path getUrlsPath();
429

430
  /**
431
   * @return the {@link UrlMetadata}. Will be lazily instantiated and thereby automatically be cloned or pulled (by default).
432
   */
433
  UrlMetadata getUrls();
434

435
  /**
436
   * @return the {@link Path} to the download cache. All downloads will be placed here using a unique naming pattern that allows to reuse these artifacts. So if
437
   *     the same artifact is requested again it will be taken from the cache to avoid downloading it again.
438
   */
439
  Path getDownloadPath();
440

441
  /**
442
   * @return the {@link Path} to the software folder inside {@link #getIdeHome() IDE_HOME}. All tools for that IDE instance will be linked here from the
443
   *     {@link #getSoftwareRepositoryPath() software repository} as sub-folder named after the according tool.
444
   */
445
  Path getSoftwarePath();
446

447
  /**
448
   * @return the {@link Path} to the extra folder inside software folder inside {@link #getIdeHome() IDE_HOME}. All tools for that IDE instance will be linked
449
   *     here from the {@link #getSoftwareRepositoryPath() software repository} as sub-folder named after the according tool.
450
   */
451
  Path getSoftwareExtraPath();
452

453
  /**
454
   * @return the {@link Path} to the global software repository. This is the central directory where the tools are extracted physically on the local disc. Those
455
   *     are shared among all IDE instances (see {@link #getIdeHome() IDE_HOME}) via symbolic links (see {@link #getSoftwarePath()}). Therefore this repository
456
   *     follows the sub-folder structure {@code «repository»/«tool»/«edition»/«version»/}. So multiple versions of the same tool exist here as different
457
   *     folders. Further, such software may not be modified so e.g. installation of plugins and other kind of changes to such tool need to happen strictly out
458
   *     of the scope of this folders.
459
   */
460
  Path getSoftwareRepositoryPath();
461

462
  /**
463
   * @return the {@link Path} to the {@link #FOLDER_PLUGINS plugins folder} inside {@link #getIdeHome() IDE_HOME}. All plugins of the IDE instance will be
464
   *     stored here. For each tool that supports plugins a sub-folder with the tool name will be created where the plugins for that tool get installed.
465
   */
466
  Path getPluginsPath();
467

468
  /**
469
   * @return the {@link Path} to the central tool repository. All tools will be installed in this location using the directory naming schema of
470
   *     {@code «repository»/«tool»/«edition»/«version»/}. Actual {@link #getIdeHome() IDE instances} will only contain symbolic links to the physical tool
471
   *     installations in this repository. This allows to share and reuse tool installations across multiple {@link #getIdeHome() IDE instances}. The variable
472
   *     {@code «repository»} is typically {@code default} for the tools from our standard {@link #getUrlsPath() ide-urls download metadata} but this will
473
   *     differ for custom tools from a private repository.
474
   */
475
  Path getToolRepositoryPath();
476

477
  /**
478
   * @return the {@link Path} to the users home directory. Typically initialized via the {@link System#getProperty(String) system property} "user.home".
479
   * @see com.devonfw.tools.ide.variable.IdeVariables#HOME
480
   */
481
  Path getUserHome();
482

483
  /**
484
   * @return the {@link Path} to the ".ide" subfolder in the {@link #getUserHome() users home directory}.
485
   */
486
  Path getUserHomeIde();
487

488
  /**
489
   * @return the {@link Path} to the {@link #FOLDER_SETTINGS settings} folder with the cloned git repository containing the project configuration.
490
   */
491
  Path getSettingsPath();
492

493
  /**
494
   * @return the {@link Path} to the {@link #FOLDER_REPOSITORIES repositories} folder with legacy fallback if not present or {@code null} if not found.
495
   */
496
  default Path getRepositoriesPath() {
497

498
    Path settingsPath = getSettingsPath();
3✔
499
    if (settingsPath == null) {
2!
500
      return null;
×
501
    }
502
    Path repositoriesPath = settingsPath.resolve(IdeContext.FOLDER_REPOSITORIES);
4✔
503
    if (Files.isDirectory(repositoriesPath)) {
5✔
504
      return repositoriesPath;
2✔
505
    }
506
    Path legacyRepositoriesPath = settingsPath.resolve(IdeContext.FOLDER_LEGACY_REPOSITORIES);
4✔
507
    if (Files.isDirectory(legacyRepositoriesPath)) {
5!
508
      return legacyRepositoriesPath;
×
509
    }
510
    return null;
2✔
511
  }
512

513
  /**
514
   * @return the {@link Path} to the {@code settings} folder with the cloned git repository containing the project configuration only if the settings repository
515
   *     is in fact a git repository.
516
   */
517
  Path getSettingsGitRepository();
518

519
  /**
520
   * @return {@code true} if the settings repository is a symlink or a junction.
521
   */
522
  boolean isSettingsRepositorySymlinkOrJunction();
523

524
  /**
525
   * @return the {@link Path} to the file containing the last tracked commit Id of the settings repository.
526
   */
527
  Path getSettingsCommitIdPath();
528

529
  /**
530
   * @return the {@link Path} to the templates folder inside the {@link #getSettingsPath() settings}. The relative directory structure in this templates folder
531
   *     is to be applied to {@link #getIdeHome() IDE_HOME} when the project is set up.
532
   */
533
  default Path getSettingsTemplatePath() {
534
    Path settingsFolder = getSettingsPath();
3✔
535
    Path templatesFolder = settingsFolder.resolve(IdeContext.FOLDER_TEMPLATES);
4✔
536
    if (!Files.isDirectory(templatesFolder)) {
5✔
537
      Path templatesFolderLegacy = settingsFolder.resolve(IdeContext.FOLDER_LEGACY_TEMPLATES);
4✔
538
      if (Files.isDirectory(templatesFolderLegacy)) {
5!
539
        templatesFolder = templatesFolderLegacy;
×
540
      } else {
541
        AbstractIdeContext.LOG.warn("No templates found in settings git repo neither in {} nor in {} - configuration broken", templatesFolder,
5✔
542
            templatesFolderLegacy);
543
        return null;
2✔
544
      }
545
    }
546
    return templatesFolder;
2✔
547
  }
548

549
  /**
550
   * @return the {@link Path} to the {@code conf} folder with instance specific tool configurations and the
551
   *     {@link EnvironmentVariablesType#CONF user specific project configuration}.
552
   */
553
  Path getConfPath();
554

555
  /**
556
   * @return the {@link Path} to the workspace.
557
   * @see #getWorkspaceName()
558
   */
559
  Path getWorkspacePath();
560

561
  /**
562
   * @return the name of the workspace. Defaults to {@link #WORKSPACE_MAIN}.
563
   */
564
  String getWorkspaceName();
565

566
  /**
567
   * @return the value of the system {@link IdeVariables#PATH PATH} variable. It is automatically extended according to the tools available in
568
   *     {@link #getSoftwarePath() software path} unless {@link #getIdeHome() IDE_HOME} was not found.
569
   */
570
  SystemPath getPath();
571

572
  /**
573
   * @return a new {@link ProcessContext} to {@link ProcessContext#run() run} external commands.
574
   */
575
  ProcessContext newProcess();
576

577
  /**
578
   * @param title the {@link IdeProgressBar#getTitle() title}.
579
   * @param size the {@link IdeProgressBar#getMaxSize() expected maximum size}.
580
   * @param unitName the {@link IdeProgressBar#getUnitName() unit name}.
581
   * @param unitSize the {@link IdeProgressBar#getUnitSize() unit size}.
582
   * @return the new {@link IdeProgressBar} to use.
583
   */
584
  IdeProgressBar newProgressBar(String title, long size, String unitName, long unitSize);
585

586
  /**
587
   * @param title the {@link IdeProgressBar#getTitle() title}.
588
   * @param size the {@link IdeProgressBar#getMaxSize() expected maximum size} in bytes.
589
   * @return the new {@link IdeProgressBar} to use.
590
   */
591
  default IdeProgressBar newProgressBarInMib(String title, long size) {
592

593
    if ((size > 0) && (size < 1024)) {
8✔
594
      return new IdeProgressBarNone(title, size, IdeProgressBar.UNIT_NAME_MB, IdeProgressBar.UNIT_SIZE_MB);
8✔
595
    }
596
    return newProgressBar(title, size, IdeProgressBar.UNIT_NAME_MB, IdeProgressBar.UNIT_SIZE_MB);
7✔
597
  }
598

599
  /**
600
   * @param size the {@link IdeProgressBar#getMaxSize() expected maximum size} in bytes.
601
   * @return the new {@link IdeProgressBar} for copy.
602
   */
603
  default IdeProgressBar newProgressBarForDownload(long size) {
604

605
    return newProgressBarInMib(IdeProgressBar.TITLE_DOWNLOADING, size);
5✔
606
  }
607

608
  /**
609
   * @param size the {@link IdeProgressBar#getMaxSize() expected maximum size} in bytes.
610
   * @return the new {@link IdeProgressBar} for extracting.
611
   */
612
  default IdeProgressBar newProgressbarForExtracting(long size) {
613

614
    return newProgressBarInMib(IdeProgressBar.TITLE_EXTRACTING, size);
5✔
615
  }
616

617
  /**
618
   * @param size the {@link IdeProgressBar#getMaxSize() expected maximum size} in bytes.
619
   * @return the new {@link IdeProgressBar} for copy.
620
   */
621
  default IdeProgressBar newProgressbarForCopying(long size) {
622

623
    return newProgressBarInMib(IdeProgressBar.TITLE_COPYING, size);
5✔
624
  }
625

626
  /**
627
   * @param size the {@link IdeProgressBar#getMaxSize() expected maximum} plugin count.
628
   * @return the new {@link IdeProgressBar} to use.
629
   */
630
  default IdeProgressBar newProgressBarForPlugins(long size) {
631
    return newProgressBar(IdeProgressBar.TITLE_INSTALL_PLUGIN, size, IdeProgressBar.UNIT_NAME_PLUGIN, IdeProgressBar.UNIT_SIZE_PLUGIN);
7✔
632
  }
633

634
  /**
635
   * @return the {@link DirectoryMerger} used to configure and merge the workspace for an {@link com.devonfw.tools.ide.tool.ide.IdeToolCommandlet IDE}.
636
   */
637
  DirectoryMerger getWorkspaceMerger();
638

639
  /**
640
   * @return the {@link Path} to the working directory from where the command is executed.
641
   */
642
  Path getDefaultExecutionDirectory();
643

644
  /**
645
   * @return the {@link IdeSystem} instance wrapping {@link System}.
646
   */
647
  IdeSystem getSystem();
648

649
  /**
650
   * @return the {@link GitContext} used to run several git commands.
651
   */
652
  GitContext getGitContext();
653

654
  /**
655
   * @return the String value for the variable MAVEN_ARGS, or null if called outside an IDEasy installation.
656
   */
657
  default String getMavenArgs() {
658

659
    if (getIdeHome() == null) {
3✔
660
      return null;
2✔
661
    }
662
    Mvn mvn = getCommandletManager().getCommandlet(Mvn.class);
6✔
663
    return mvn.getMavenArgs();
3✔
664
  }
665

666
  /**
667
   * @return the path for the variable GRADLE_USER_HOME, or null if called outside an IDEasy installation.
668
   */
669
  default Path getGradleUserHome() {
670

671
    if (getIdeHome() == null) {
3✔
672
      return null;
2✔
673
    }
674
    Gradle gradle = getCommandletManager().getCommandlet(Gradle.class);
6✔
675
    return gradle.getOrCreateGradleConfFolder();
3✔
676
  }
677

678
  /**
679
   * @return the {@link Path} pointing to the maven configuration directory (where "settings.xml" or "settings-security.xml" are located).
680
   */
681
  default Path getMavenConfigurationFolder() {
682

683
    if (getIdeHome() == null) {
3✔
684
      // fallback to USER_HOME/.m2 folder if called outside an IDEasy project
685
      return getUserHome().resolve(Mvn.MVN_CONFIG_LEGACY_FOLDER);
5✔
686
    }
687
    Mvn mvn = getCommandletManager().getCommandlet(Mvn.class);
6✔
688
    return mvn.getMavenConfigurationFolder();
3✔
689
  }
690

691
  /**
692
   * Updates the current working directory (CWD) and configures the environment paths according to the specified parameters. This method is central to changing
693
   * the IDE's notion of where it operates, affecting where configurations, workspaces, settings, and other resources are located or loaded from.
694
   *
695
   * @return the current {@link Step} of processing.
696
   */
697
  Step getCurrentStep();
698

699
  /**
700
   * @param name the {@link Step#getName() name} of the new {@link Step}.
701
   * @return the new {@link Step} that has been created and started.
702
   */
703
  default Step newStep(String name) {
704

705
    return newStep(name, Step.NO_PARAMS);
5✔
706
  }
707

708
  /**
709
   * @param name the {@link Step#getName() name} of the new {@link Step}.
710
   * @param parameters the {@link Step#getParameter(int) parameters} of the {@link Step}.
711
   * @return the new {@link Step} that has been created and started.
712
   */
713
  default Step newStep(String name, Object... parameters) {
714

715
    return newStep(false, name, parameters);
6✔
716
  }
717

718
  /**
719
   * @param silent the {@link Step#isSilent() silent flag}.
720
   * @param name the {@link Step#getName() name} of the new {@link Step}.
721
   * @param parameters the {@link Step#getParameter(int) parameters} of the {@link Step}.
722
   * @return the new {@link Step} that has been created and started.
723
   */
724
  Step newStep(boolean silent, String name, Object... parameters);
725

726
  /**
727
   * @param lambda the {@link Runnable} to {@link Runnable#run() run} while the {@link com.devonfw.tools.ide.log.IdeLogger logging} is entirely disabled.
728
   *     After this the logging will be enabled again. Collected log messages will then be logged at the end.
729
   */
730
  default void runWithoutLogging(Runnable lambda) {
731

732
    runWithoutLogging(lambda, IdeLogLevel.TRACE);
4✔
733
  }
1✔
734

735
  /**
736
   * @param lambda the {@link Runnable} to {@link Runnable#run() run} while the {@link com.devonfw.tools.ide.log.IdeLogger logging} is entirely disabled.
737
   *     After this the logging will be enabled again. Collected log messages will then be logged at the end.
738
   * @param threshold the {@link IdeLogLevel} to use as threshold for filtering logs while logging is disabled and log messages are collected. Use
739
   *     {@link IdeLogLevel#TRACE} to collect all logs and ensure nothing gets lost (will still not log anything that is generally not active in regular
740
   *     logging) and e.g. use {@link IdeLogLevel#ERROR} to discard all logs except errors.
741
   */
742
  void runWithoutLogging(Runnable lambda, IdeLogLevel threshold);
743

744
  /**
745
   * Updates the current working directory (CWD) and configures the environment paths according to the specified parameters. This method is central to changing
746
   * the IDE's notion of where it operates, affecting where configurations, workspaces, settings, and other resources are located or loaded from.
747
   *
748
   * @param ideHome The path to the IDE home directory.
749
   */
750
  default void setIdeHome(Path ideHome) {
751

752
    setCwd(ideHome, WORKSPACE_MAIN, ideHome);
5✔
753
  }
1✔
754

755
  /**
756
   * Updates the current working directory (CWD) and configures the environment paths according to the specified parameters. This method is central to changing
757
   * the IDE's notion of where it operates, affecting where configurations, workspaces, settings, and other resources are located or loaded from.
758
   *
759
   * @param userDir The path to set as the current working directory.
760
   * @param workspace The name of the workspace within the IDE's environment.
761
   * @param ideHome The path to the IDE home directory.
762
   */
763
  void setCwd(Path userDir, String workspace, Path ideHome);
764

765
  /**
766
   * Finds the path to the Bash executable.
767
   *
768
   * @return the {@link Path} to the Bash executable, or {@code null} if Bash is not found.
769
   */
770
  Path findBash();
771

772
  /**
773
   * Finds the path to the Bash executable.
774
   *
775
   * @return the {@link Path} to the Bash executable. Throws a {@link CliException} if no bash was found.
776
   */
777
  default Path findBashRequired() {
778
    Path bash = findBash();
3✔
779
    if (bash == null) {
2!
780
      String message = "Bash " + IS_NOT_INSTALLED_BUT_REQUIRED;
×
781
      if (getSystemInfo().isWindows()) {
×
782
        message += " " + PLEASE_DOWNLOAD_AND_INSTALL_GIT + ":\n " + WINDOWS_GIT_DOWNLOAD_URL;
×
783
        throw new CliException(message);
×
784
      }
785
      bash = Path.of("bash");
×
786
    }
787

788
    return bash;
2✔
789
  }
790

791
  /**
792
   * @return the {@link WindowsPathSyntax} used for {@link Path} conversion or {@code null} for no such conversion (typically if not on Windows).
793
   */
794
  WindowsPathSyntax getPathSyntax();
795

796
  /**
797
   * logs the status of {@link #getIdeHome() IDE_HOME} and {@link #getIdeRoot() IDE_ROOT}.
798
   */
799
  void logIdeHomeAndRootStatus();
800

801
  /**
802
   * @param version the {@link VersionIdentifier} to write.
803
   * @param installationPath the {@link Path directory} where to write the version to a {@link #FILE_SOFTWARE_VERSION version file}.
804
   */
805
  void writeVersionFile(VersionIdentifier version, Path installationPath);
806

807
  /**
808
   * Verifies that current {@link IdeVersion} satisfies {@link IdeVariables#IDE_MIN_VERSION}.
809
   *
810
   * @param throwException whether to throw a {@link CliException} or just log a warning.
811
   */
812
  void verifyIdeMinVersion(boolean throwException);
813

814
  /**
815
   * @return the path for the variable COREPACK_HOME, or null if called outside an IDEasy installation.
816
   */
817
  default Path getCorePackHome() {
818
    if (getIdeHome() == null) {
×
819
      return null;
×
820
    }
821
    Corepack corepack = getCommandletManager().getCommandlet(Corepack.class);
×
822
    return corepack.getOrCreateCorepackHomeFolder();
×
823
  }
824

825
  /**
826
   * @return the path for the variable NPM_CONFIG_USERCONFIG, or null if called outside an IDEasy installation.
827
   */
828
  default Path getNpmConfigUserConfig() {
829
    if (getIdeHome() == null) {
3✔
830
      return null;
2✔
831
    }
832
    Npm npm = getCommandletManager().getCommandlet(Npm.class);
6✔
833
    return npm.getOrCreateNpmConfigUserConfig();
3✔
834
  }
835

836
}
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