This should work: SolrCore solrCore = coreContainer.create(coreName, Paths.get(coreHome).resolve(coreName), Collections.emptyMap());
Alan Woodward www.flax.co.uk > On 3 Oct 2016, at 18:41, Bryan Bende <bbe...@gmail.com> wrote: > > Curious if anyone knows how to create an EmbeddedSolrServer in Solr 6.x, > with a core where the dataDir is located somewhere outside of where the > config is located. > > I'd like to do this without system properties, and all through Java code. > > In Solr 5.x I was able to do this with the following code: > > CoreContainer coreContainer = new CoreContainer(solrHome); > coreContainer.load(); > > Properties props = new Properties(); > props.setProperty("dataDir", dataDir + "/" + coreName); > > CoreDescriptor descriptor = new CoreDescriptor(coreContainer, coreName, > new File(coreHome, coreName).getAbsolutePath(), props); > > SolrCore solrCore = coreContainer.create(descriptor); > new EmbeddedSolrServer(coreContainer, coreName); > > > The CoreContainer API changed a bit in 6.x and you can no longer pass in a > descriptor. I've tried a couple of things with the current API, but haven't > been able to get it working. > > Any ideas are appreciated. > > Thanks, > > Bryan