void (@NotNull Consumer<String> logMessage, @NotNull Project project) { logMessage.accept("Settings up SDK: name: " + mySdkName + ", type: " + mySdkType + ", home: " + mySdkHome); Sdk sdk = setupOrDetectSdk(logMessage); ProjectRootManager rootManager = ProjectRootManager.getInstance(project); Sdk projectSdk = rootManager.getProjectSdk(); if (!Objects.equals(projectSdk, sdk)) { logMessage.accept("Project uses different SDK: " + projectSdk + " " + "(sdkName is " + rootManager.getProjectSdkName() + ", " + "type " + rootManager.getProjectSdkTypeName() + "). Updating..."); rootManager.setProjectSdk(sdk); } logMessage.accept("Project SDK is set to use the new SDK"); for (Module module : ModuleManager.getInstance(project).getModules()) { Sdk moduleSdk = ModuleRootManager.getInstance(module).getSdk(); if (!Objects.equals(moduleSdk, sdk)) { logMessage.accept("Module " + module.getName() + " uses different SDK: " + moduleSdk + " IGNORING!"); } } }