Skip to content

Commit c35e971

Browse files
authored
#588: reload context after clone settings (#642)
1 parent b782cc6 commit c35e971

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

CHANGELOG.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Release with new features and bugfixes:
2121
* https://github.com/devonfw/IDEasy/issues/440[#440]: Generalize intellij OS startup command for all OS's
2222
* https://github.com/devonfw/IDEasy/issues/612[#612]: Automatically generated issue URL is still pointing to ide instead of IDEasy
2323
* https://github.com/devonfw/IDEasy/issues/52[#52]: Adjusting Intellij settings in ide-settings
24+
* https://github.com/devonfw/IDEasy/issues/588[#588]: ide create installs wrong Java version
25+
2426
The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/13?closed=1[milestone 2024.09.002].
2527

2628
== 2024.09.001

cli/src/main/java/com/devonfw/tools/ide/commandlet/AbstractUpdateCommandlet.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.List;
77
import java.util.Set;
88

9+
import com.devonfw.tools.ide.context.AbstractIdeContext;
910
import com.devonfw.tools.ide.context.GitContext;
1011
import com.devonfw.tools.ide.context.IdeContext;
1112
import com.devonfw.tools.ide.property.FlagProperty;
@@ -45,6 +46,7 @@ public void run() {
4546

4647
updateSettings();
4748
updateConf();
49+
reloadContext();
4850

4951
if (this.skipTools.isTrue()) {
5052
this.context.info("Skipping installation/update of tools as specified by the user.");
@@ -53,6 +55,11 @@ public void run() {
5355
}
5456
}
5557

58+
private void reloadContext() {
59+
60+
((AbstractIdeContext) this.context).reload();
61+
}
62+
5663
private void updateConf() {
5764

5865
Path templatesFolder = this.context.getSettingsPath().resolve(IdeContext.FOLDER_TEMPLATES);

cli/src/main/java/com/devonfw/tools/ide/context/AbstractIdeContext.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public abstract class AbstractIdeContext implements IdeContext {
9292

9393
private Path downloadPath;
9494

95-
private Path toolRepository;
95+
private Path toolRepositoryPath;
9696

9797
private Path userHome;
9898

@@ -169,14 +169,14 @@ public AbstractIdeContext(IdeStartContextImpl startContext, Path userDir, ToolRe
169169
setCwd(userDir, workspace, currentDir);
170170

171171
if (this.ideRoot == null) {
172-
this.toolRepository = null;
172+
this.toolRepositoryPath = null;
173173
this.urlsPath = null;
174174
this.tempPath = null;
175175
this.tempDownloadPath = null;
176176
this.softwareRepositoryPath = null;
177177
} else {
178178
Path ideBase = this.ideRoot.resolve(FOLDER_IDE);
179-
this.toolRepository = ideBase.resolve("software");
179+
this.toolRepositoryPath = ideBase.resolve("software");
180180
this.urlsPath = ideBase.resolve("urls");
181181
this.tempPath = ideBase.resolve("tmp");
182182
this.tempDownloadPath = this.tempPath.resolve(FOLDER_DOWNLOADS);
@@ -490,7 +490,7 @@ public Path getUrlsPath() {
490490
@Override
491491
public Path getToolRepositoryPath() {
492492

493-
return this.toolRepository;
493+
return this.toolRepositoryPath;
494494
}
495495

496496
@Override
@@ -1051,4 +1051,11 @@ public IdeStartContextImpl getStartContext() {
10511051

10521052
return startContext;
10531053
}
1054+
1055+
/**
1056+
* Reloads this context and re-initializes the {@link #getVariables() variables}.
1057+
*/
1058+
public void reload() {
1059+
this.variables = createVariables();
1060+
}
10541061
}

0 commit comments

Comments
 (0)