isTrue(solrXml.exists(), "File not found: {}", solrXml);
final File dataDir = findSolrDataDir(env);
final Map<String, String> coreDefs = new LinkedHashMap<String, String>();
CoreContainer cores = new CoreContainer(solrHome.getAbsolutePath(), solrXml) {
@Override
public SolrCore create(final CoreDescriptor coreDescriptor)
throws ParserConfigurationException, IOException, SAXException {
coreDescriptor.getDataDir();
String coreName = coreDescriptor.getName();
if (coreName.length() == 0) {
coreName = getDefaultCoreName();
}
// Set the core data directory.
String coreDataDir = new File(dataDir, coreName).getAbsolutePath();
coreDefs.put(coreName, coreDataDir);
coreDescriptor.setDataDir(coreDataDir);
return super.create(coreDescriptor);
}
};
// Initialize cores
cores.load(solrHome.getAbsolutePath(), solrXml);
logger.info("Solr home directory: {}", solrHome);
for (Entry<String, String> core : coreDefs.entrySet()) {
logger.info(" core: {}, dataDir: {}", core.getKey(), core.getValue());
}