diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/intellij/Intellij.java b/cli/src/main/java/com/devonfw/tools/ide/tool/intellij/Intellij.java index 5fc54fe44..42538d7db 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/intellij/Intellij.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/intellij/Intellij.java @@ -8,6 +8,8 @@ import com.devonfw.tools.ide.cli.CliArgument; import com.devonfw.tools.ide.common.Tag; import com.devonfw.tools.ide.context.IdeContext; +import com.devonfw.tools.ide.environment.EnvironmentVariables; +import com.devonfw.tools.ide.environment.EnvironmentVariablesType; import com.devonfw.tools.ide.io.FileAccess; import com.devonfw.tools.ide.process.ProcessMode; import com.devonfw.tools.ide.tool.ide.IdeToolCommandlet; @@ -68,6 +70,9 @@ public boolean install(boolean silent) { protected void postInstall() { super.postInstall(); + EnvironmentVariables envVars = this.context.getVariables().getByType(EnvironmentVariablesType.CONF); + envVars.set("IDEA_PROPERTIES", this.context.getWorkspacePath().resolve("idea.properties").toString(), true); + envVars.save(); if (this.context.getSystemInfo().isMac()) { setMacOsFilePermissions(getToolPath().resolve("IntelliJ IDEA" + generateMacEditionString() + ".app").resolve("Contents").resolve("MacOS").resolve(IDEA)); } diff --git a/cli/src/main/java/com/devonfw/tools/ide/variable/IdeVariables.java b/cli/src/main/java/com/devonfw/tools/ide/variable/IdeVariables.java index 46cf87038..bc0a4b47b 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/variable/IdeVariables.java +++ b/cli/src/main/java/com/devonfw/tools/ide/variable/IdeVariables.java @@ -80,15 +80,10 @@ public interface IdeVariables { VariableDefinitionBoolean IDE_VARIABLE_SYNTAX_LEGACY_SUPPORT_ENABLED = new VariableDefinitionBoolean("IDE_VARIABLE_SYNTAX_LEGACY_SUPPORT_ENABLED", null, c -> Boolean.TRUE); - /** - * {@link VariableDefinition} for IDEA_PROPERTIES (used to overwrite idea.properties location). - */ - VariableDefinitionPath IDEA_PROPERTIES = new VariableDefinitionPath("IDEA_PROPERTIES", null, c -> c.getWorkspacePath().resolve("idea.properties"), true); - /** A {@link Collection} with all pre-defined {@link VariableDefinition}s. */ Collection> VARIABLES = List.of(PATH, HOME, WORKSPACE_PATH, IDE_HOME, IDE_ROOT, WORKSPACE, IDE_TOOLS, CREATE_START_SCRIPTS, IDE_MIN_VERSION, MVN_VERSION, M2_REPO, DOCKER_EDITION, MVN_BUILD_OPTS, NPM_BUILD_OPTS, GRADLE_BUILD_OPTS, YARN_BUILD_OPTS, JASYPT_OPTS, MAVEN_ARGS, - PROJECT_NAME, IDE_VARIABLE_SYNTAX_LEGACY_SUPPORT_ENABLED, IDEA_PROPERTIES); + PROJECT_NAME, IDE_VARIABLE_SYNTAX_LEGACY_SUPPORT_ENABLED); /** * @param name the name of the requested {@link VariableDefinition}. diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java index 3a80c53fa..7f91568bc 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java @@ -78,6 +78,7 @@ public void testIntellijRun(String os) { private void checkInstallation(IdeTestContext context) { assertThat(context.getSoftwarePath().resolve("intellij/.ide.software.version")).exists().hasContent("2023.3.3"); + assertThat(context.getVariables().get("IDEA_PROPERTIES")).isEqualTo(context.getWorkspacePath().resolve("idea.properties").toString()); assertLogMessage(context, IdeLogLevel.SUCCESS, "Successfully installed java in version 17.0.10_7"); assertLogMessage(context, IdeLogLevel.SUCCESS, "Successfully installed intellij in version 2023.3.3"); } diff --git a/cli/src/test/resources/ide-projects/intellij/project/conf/ide.properties b/cli/src/test/resources/ide-projects/intellij/project/conf/ide.properties new file mode 100644 index 000000000..e3e9d226d --- /dev/null +++ b/cli/src/test/resources/ide-projects/intellij/project/conf/ide.properties @@ -0,0 +1 @@ +# here the INTELLIJ_PROPERTIES variable should be added by the test