}
for (ModuleDefinition entry : model.getModules()) {
if (infolog.isInfoEnabled()) {
infolog.debug("Reading module config " + entry.getId() + " - " + entry.getFile().getAbsolutePath());
}
ModuleConfig moduleConf = ModuleConfigBuilder.build(entry, this);
moduleConfigs.add(moduleConf);
}
// Check / build class path configurations
Conf classLoadingConf = confRegistry.getConfiguration("classloading");
List<ClasspathEntry> sharedClasspath = ClassLoaderConfigurer.configureClassPaths(moduleConfigs,
settings.getEnableArtifactSharing(), classLoadingConf);
// Construct the shared classloader
infolog.debug("Creating shared classloader");
rootClassLoader = ClassLoaderBuilder.build(sharedClasspath, this.getClass().getClassLoader(), settings.getRepository());
// Construct the classloaders of the various modules
List<ClassLoader> moduleClassLoaders = new ArrayList<ClassLoader>();
for (ModuleConfig cfg : moduleConfigs) {
ClassLoader classLoader = cfg.getClassLoadingConfig().getClassLoader(getClassLoader());
moduleClassLoaders.add(classLoader);
}
// Initialize the ConfManager for the modules configuration
confManager.initModulesConfig(moduleConfigs);
// Create the modules
infolog.info("Starting the modules.");
modules = new ArrayList<Module>(model.getModules().size());
for (int i = 0; i < moduleConfigs.size(); i++) {
ModuleConfig moduleConfig = moduleConfigs.get(i);
Module module = ModuleBuilder.build(moduleConfig, moduleClassLoaders.get(i), this);
modules.add(module);
modulesById.put(module.getDefinition().getId(), module);
}