void (@NotNull Path dir, @NotNull Executor executor) { myProject.setName(getDirectoryBaseProjectName(dir)); Path defaultConfigFile = dir.resolve("misc.xml"); JpsSdkType<?> projectSdkType = loadProjectRoot(loadRootElement(defaultConfigFile)); for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) { for (JpsProjectExtensionSerializer serializer : extension.getProjectExtensionSerializers()) { loadComponents(dir, defaultConfigFile, serializer, myProject); } } Path externalConfigDir = resolveExternalProjectConfig("project"); if (externalConfigDir != null) { LOG.info("External project config dir is used: " + externalConfigDir); } Element moduleData = JDomSerializationUtil.findComponent(loadRootElement(dir.resolve("modules.xml")), MODULE_MANAGER_COMPONENT); Element externalModuleData; if (externalConfigDir == null) { externalModuleData = null; } else { Element rootElement = loadRootElement(externalConfigDir.resolve("modules.xml")); if (rootElement == null) { externalModuleData = null; } else { externalModuleData = JDomSerializationUtil.findComponent(rootElement, "ExternalProjectModuleManager"); if (externalModuleData == null) { externalModuleData = JDomSerializationUtil.findComponent(rootElement, "ExternalModuleListStorage"); } // old format (root tag is "component") if (externalModuleData == null && rootElement.getName().equals(JDomSerializationUtil.COMPONENT_ELEMENT)) { externalModuleData = rootElement; } } } if (externalModuleData != null) { String componentName = externalModuleData.getAttributeValue("name"); LOG.assertTrue(componentName != null && componentName.startsWith("External")); externalModuleData.setAttribute("name", componentName.substring("External".length())); if (moduleData == null) { moduleData = externalModuleData; } else { JDOMUtil.deepMerge(moduleData, externalModuleData); } } Path workspaceFile = dir.resolve("workspace.xml"); loadModules(moduleData, projectSdkType, workspaceFile, executor); Runnable timingLog = TimingLog.startActivity("loading project libraries"); for (Path libraryFile : listXmlFiles(dir.resolve("libraries"))) { loadProjectLibraries(loadRootElement(libraryFile)); } if (externalConfigDir != null) { loadProjectLibraries(loadRootElement(externalConfigDir.resolve("libraries.xml"))); } timingLog.run(); Runnable artifactsTimingLog = TimingLog.startActivity("loading artifacts"); for (Path artifactFile : listXmlFiles(dir.resolve("artifacts"))) { loadArtifacts(loadRootElement(artifactFile)); } if (externalConfigDir != null) { loadArtifacts(loadRootElement(externalConfigDir.resolve("artifacts.xml"))); } artifactsTimingLog.run(); if (hasRunConfigurationSerializers()) { Runnable runConfTimingLog = TimingLog.startActivity("loading run configurations"); for (Path configurationFile : listXmlFiles(dir.resolve("runConfigurations"))) { JpsRunConfigurationSerializer.loadRunConfigurations(myProject, loadRootElement(configurationFile)); } JpsRunConfigurationSerializer.loadRunConfigurations(myProject, JDomSerializationUtil.findComponent(loadRootElement(workspaceFile), "RunManager")); runConfTimingLog.run(); } }