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

devonfw / IDEasy / 13259677133

11 Feb 2025 09:26AM UTC coverage: 68.445% (-0.02%) from 68.469%
13259677133

Pull #1026

github

web-flow
Merge 85479f434 into 9c2006bd8
Pull Request #1026: #1022: remove hardcoded dependency from intellij

2860 of 4595 branches covered (62.24%)

Branch coverage included in aggregate %.

7391 of 10382 relevant lines covered (71.19%)

3.1 hits per line

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

88.57
cli/src/main/java/com/devonfw/tools/ide/tool/intellij/Intellij.java
1
package com.devonfw.tools.ide.tool.intellij;
2

3
import java.nio.file.Files;
4
import java.util.ArrayList;
5
import java.util.List;
6
import java.util.Set;
7

8
import com.devonfw.tools.ide.common.Tag;
9
import com.devonfw.tools.ide.context.IdeContext;
10
import com.devonfw.tools.ide.process.EnvironmentContext;
11
import com.devonfw.tools.ide.process.ProcessErrorHandling;
12
import com.devonfw.tools.ide.process.ProcessMode;
13
import com.devonfw.tools.ide.process.ProcessResult;
14
import com.devonfw.tools.ide.step.Step;
15
import com.devonfw.tools.ide.tool.ToolInstallation;
16
import com.devonfw.tools.ide.tool.ide.IdeToolCommandlet;
17
import com.devonfw.tools.ide.tool.ide.IdeaBasedIdeToolCommandlet;
18
import com.devonfw.tools.ide.tool.plugin.ToolPluginDescriptor;
19

20
/**
21
 * {@link IdeToolCommandlet} for <a href="https://www.jetbrains.com/idea/">IntelliJ</a>.
22
 */
23
public class Intellij extends IdeaBasedIdeToolCommandlet {
24

25
  private static final String IDEA = "idea";
26

27
  private static final String IDEA64_EXE = IDEA + "64.exe";
28

29
  private static final String IDEA_BASH_SCRIPT = IDEA + ".sh";
30

31
  /**
32
   * The constructor.
33
   *
34
   * @param context the {@link IdeContext}.
35
   */
36
  public Intellij(IdeContext context) {
37

38
    super(context, "intellij", Set.of(Tag.INTELLIJ));
6✔
39
  }
1✔
40

41
  @Override
42
  protected String getBinaryName() {
43

44
    if (this.context.getSystemInfo().isWindows()) {
5✔
45
      return IDEA64_EXE;
2✔
46
    } else {
47
      if (Files.exists(this.getToolBinPath().resolve(IDEA))) {
8✔
48
        return IDEA;
2✔
49
      } else if (Files.exists(this.getToolBinPath().resolve(IDEA_BASH_SCRIPT))) {
8✔
50
        return IDEA_BASH_SCRIPT;
2✔
51
      } else {
52
        return IDEA;
2✔
53
      }
54
    }
55
  }
56

57
  @Override
58
  protected void setEnvironment(EnvironmentContext environmentContext, ToolInstallation toolInstallation, boolean extraInstallation) {
59

60
    super.setEnvironment(environmentContext, toolInstallation, extraInstallation);
5✔
61
    environmentContext.withEnvVar("IDEA_PROPERTIES", this.context.getWorkspacePath().resolve("idea.properties").toString());
10✔
62
  }
1✔
63

64
  @Override
65
  public void installPlugin(ToolPluginDescriptor plugin, final Step step) {
66

67
    // In case of plugins with a custom repo url
68
    boolean customRepo = plugin.url() != null;
6!
69
    List<String> args = new ArrayList<>();
4✔
70
    args.add("installPlugins");
4✔
71
    args.add(plugin.id());
5✔
72
    if (customRepo) {
2!
73
      args.add(plugin.url());
5✔
74
    }
75
    ProcessResult result = runTool(ProcessMode.DEFAULT, null, ProcessErrorHandling.LOG_WARNING, args.toArray(new String[0]));
11✔
76
    if (result.isSuccessful()) {
3!
77
      step.success();
3✔
78
    } else {
79
      step.error("Failed to install plugin {} ({}): exit code was {}", plugin.name(), plugin.id(), result.getExitCode());
×
80
    }
81
  }
1✔
82

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