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

devonfw / IDEasy / 15901127336

26 Jun 2025 11:54AM UTC coverage: 67.781% (+0.03%) from 67.754%
15901127336

push

github

web-flow
#1354: Add gradle user home handling (#1356)

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

3187 of 5108 branches covered (62.39%)

Branch coverage included in aggregate %.

8167 of 11643 relevant lines covered (70.15%)

3.08 hits per line

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

95.24
cli/src/main/java/com/devonfw/tools/ide/variable/IdeVariables.java
1
package com.devonfw.tools.ide.variable;
2

3
import java.nio.file.Path;
4
import java.util.Collection;
5
import java.util.List;
6

7
import com.devonfw.tools.ide.context.IdeContext;
8
import com.devonfw.tools.ide.git.GitUrlSyntax;
9

10
/**
11
 * Interface (mis)used to define all the available variables.
12
 */
13
public interface IdeVariables {
14

15
  /** {@link VariableDefinition} for {@link com.devonfw.tools.ide.context.IdeContext#getIdeHome() IDE_HOME}. */
16
  VariableDefinitionPath IDE_HOME = new VariableDefinitionPath("IDE_HOME", "DEVON_IDE_HOME", c -> c.getIdeHome(), true);
11✔
17

18
  /** {@link VariableDefinition} for {@link com.devonfw.tools.ide.context.IdeContext#getIdeRoot() IDE_ROOT}. */
19
  VariableDefinitionPath IDE_ROOT = new VariableDefinitionPath("IDE_ROOT", null, c -> c.getIdeRoot());
10✔
20

21
  /** {@link VariableDefinition} for {@link com.devonfw.tools.ide.context.IdeContext#getUserHome() HOME}. */
22
  VariableDefinitionPath HOME = new VariableDefinitionPath("HOME", null, c -> c.getUserHome(), true);
11✔
23

24
  /** {@link VariableDefinition} for {@link com.devonfw.tools.ide.context.IdeContext#getWorkspaceName() WORKSPACE}. */
25
  VariableDefinitionString WORKSPACE = new VariableDefinitionString("WORKSPACE", null, c -> c.getWorkspaceName(), true);
11✔
26

27
  /** {@link VariableDefinition} for {@link com.devonfw.tools.ide.context.IdeContext#getPath() PATH}. */
28
  VariableDefinitionSystemPath PATH = new VariableDefinitionSystemPath("PATH", null, c -> c.getPath(), true, true);
12✔
29

30
  /** {@link VariableDefinition} for {@link com.devonfw.tools.ide.context.IdeContext#getWorkspacePath() WORKSPACE_PATH}. */
31
  VariableDefinitionPath WORKSPACE_PATH = new VariableDefinitionPath("WORKSPACE_PATH", null, c -> c.getWorkspacePath(), true);
11✔
32

33
  /** {@link VariableDefinition} for list of tools to install by default. */
34
  VariableDefinitionStringList IDE_TOOLS = new VariableDefinitionStringList("IDE_TOOLS", "DEVON_IDE_TOOLS", c -> List.of("mvn", "npm"));
11✔
35

36
  /** {@link VariableDefinition} for list of IDE tools to create start scripts for. */
37
  VariableDefinitionStringList CREATE_START_SCRIPTS = new VariableDefinitionStringList("CREATE_START_SCRIPTS", "DEVON_CREATE_START_SCRIPTS");
6✔
38

39
  /** {@link VariableDefinition} for minimum IDE product version. */
40
  // TODO define initial IDEasy version as default value
41
  VariableDefinitionVersion IDE_MIN_VERSION = new VariableDefinitionVersion("IDE_MIN_VERSION");
5✔
42

43
  /** {@link VariableDefinition} for version of maven (mvn). */
44
  VariableDefinitionVersion MVN_VERSION = new VariableDefinitionVersion("MVN_VERSION", "MAVEN_VERSION");
6✔
45

46
  /** {@link VariableDefinition} arguments for maven to locate the settings file. */
47
  VariableDefinitionString MAVEN_ARGS = new VariableDefinitionString("MAVEN_ARGS", null, IdeContext::getMavenArgs, false, true);
9✔
48

49
  /** {@link VariableDefinition} arguments for maven to set the m2 repo location. */
50
  VariableDefinitionPath M2_REPO = new VariableDefinitionPath("M2_REPO", null, IdeVariables::getMavenRepositoryPath, false, true);
9✔
51

52
  /** {@link VariableDefinition} for {@link com.devonfw.tools.ide.context.IdeContext#getWorkspaceName() WORKSPACE}. */
53
  VariableDefinitionString DOCKER_EDITION = new VariableDefinitionString("DOCKER_EDITION", null, c -> "rancher");
7✔
54

55
  /** {@link VariableDefinition} for default build options of mvn */
56
  VariableDefinitionString MVN_BUILD_OPTS = new VariableDefinitionString("MVN_BUILD_OPTS", null, c -> "clean install");
7✔
57

58
  /** {@link VariableDefinition} for default build options of npm */
59
  // TODO: add default build options, see: https://github.com/devonfw/IDEasy/issues/441
60
  VariableDefinitionString NPM_BUILD_OPTS = new VariableDefinitionString("NPM_BUILD_OPTS", null, c -> "");
9✔
61

62
  /** {@link VariableDefinition} for default build options of gradle */
63
  VariableDefinitionString GRADLE_BUILD_OPTS = new VariableDefinitionString("GRADLE_BUILD_OPTS", null, c -> "clean dist");
9✔
64

65
  /** {@link VariableDefinition} for default user home of gradle */
66
  VariableDefinitionPath GRADLE_USER_HOME = new VariableDefinitionPath("GRADLE_USER_HOME", null, IdeContext::getGradleUserHome, false, true);
9✔
67

68
  /** {@link VariableDefinition} for default build options of yarn */
69
  // TODO: add default build options, see: https://github.com/devonfw/IDEasy/issues/441
70
  VariableDefinitionString YARN_BUILD_OPTS = new VariableDefinitionString("YARN_BUILD_OPTS", null, c -> "");
7✔
71

72
  /** {@link VariableDefinition} for options of jasypt */
73
  VariableDefinitionString JASYPT_OPTS = new VariableDefinitionString("JASYPT_OPTS", null,
7✔
74
      c -> "algorithm=PBEWITHHMACSHA512ANDAES_256 ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator");
2✔
75

76
  /** {@link VariableDefinition} for {@link com.devonfw.tools.ide.context.IdeContext#getProjectName() PROJECT_NAME}. */
77
  VariableDefinitionString PROJECT_NAME = new VariableDefinitionString("PROJECT_NAME", null, c -> c.getProjectName());
10✔
78

79
  /** Preferred Git protocol (HTTPS/SSH) as defined by {@link GitUrlSyntax}. */
80
  VariableDefinitionEnum<GitUrlSyntax> PREFERRED_GIT_PROTOCOL = new VariableDefinitionEnum<>("PREFERRED_GIT_PROTOCOL", null, GitUrlSyntax.class,
8✔
81
      c -> GitUrlSyntax.DEFAULT);
2✔
82

83
  /**
84
   * {@link VariableDefinition} for support of legacy variable syntax when
85
   * {@link com.devonfw.tools.ide.environment.EnvironmentVariables#resolve(String, Object, boolean) resolving variables} in configuration templates.
86
   */
87
  VariableDefinitionBoolean IDE_VARIABLE_SYNTAX_LEGACY_SUPPORT_ENABLED = new VariableDefinitionBoolean("IDE_VARIABLE_SYNTAX_LEGACY_SUPPORT_ENABLED", null,
7✔
88
      c -> Boolean.TRUE);
2✔
89

90
  /**
91
   * {@link VariableDefinition} for support of legacy xml templates without XML merge namespace
92
   */
93
  VariableDefinitionBoolean IDE_XML_MERGE_LEGACY_SUPPORT_ENABLED = new VariableDefinitionBoolean("IDE_XML_MERGE_LEGACY_SUPPORT_ENABLED", null,
7✔
94
      c -> Boolean.FALSE);
2✔
95

96
  /** {@link VariableDefinition} for {@link com.devonfw.tools.ide.context.IdeContext#getProjectName() DEVON_IDE_CUSTOM_TOOLS}. */
97
  VariableDefinitionString DEVON_IDE_CUSTOM_TOOLS = new VariableDefinitionString("DEVON_IDE_CUSTOM_TOOLS");
5✔
98

99
  /** A {@link Collection} with all pre-defined {@link VariableDefinition}s. */
100
  Collection<VariableDefinition<?>> VARIABLES = List.of(PATH, HOME, WORKSPACE_PATH, IDE_HOME, IDE_ROOT, WORKSPACE, IDE_TOOLS, CREATE_START_SCRIPTS,
93✔
101
      IDE_MIN_VERSION, MVN_VERSION, M2_REPO, DOCKER_EDITION, MVN_BUILD_OPTS, NPM_BUILD_OPTS, GRADLE_BUILD_OPTS, GRADLE_USER_HOME, YARN_BUILD_OPTS, JASYPT_OPTS,
102
      MAVEN_ARGS,
103
      PROJECT_NAME, IDE_VARIABLE_SYNTAX_LEGACY_SUPPORT_ENABLED, PREFERRED_GIT_PROTOCOL);
104

105
  /**
106
   * @param name the name of the requested {@link VariableDefinition}.
107
   * @return the {@link VariableDefinition} for the given {@code name} or {@code null} if not defined.
108
   * @see VariableDefinition#getName()
109
   * @see VariableDefinition#getLegacyName()
110
   */
111
  static VariableDefinition<?> get(String name) {
112

113
    return IdeVariablesList.get(name);
3✔
114
  }
115

116
  /**
117
   * @param name the name of the variable.
118
   * @return {@code true} if a {@link VariableDefinition#getLegacyName() legacy variable}, {@code false} otherwise.
119
   */
120
  static boolean isLegacyVariable(String name) {
121
    VariableDefinition<?> variableDefinition = IdeVariablesList.get(name);
3✔
122
    if (variableDefinition != null) {
2✔
123
      return name.equals(variableDefinition.getLegacyName());
5✔
124
    }
125
    return false;
2✔
126
  }
127

128
  private static Path getMavenRepositoryPath(IdeContext context) {
129
    Path mvnConf = context.getMavenConfigurationFolder();
3✔
130
    if (mvnConf == null) {
2!
131
      return null;
×
132
    }
133
    return mvnConf.resolve("repository");
4✔
134
  }
135
}
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