diff --git a/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java b/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java index 608626a7581..cd10c76180e 100755 --- a/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java @@ -39,7 +39,7 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4 public static JettySolrRunner createJetty(String solrHome, String configFile, String context) throws Exception { // creates the data dir - initCore(null, null); + initCore(null, null, solrHome); ignoreException("maxWarmingSearchers"); diff --git a/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java b/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java index 316bf93a239..35e41c272fa 100644 --- a/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java +++ b/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java @@ -37,7 +37,17 @@ public class ExternalPaths { static String determineSourceHome() { // ugly, ugly hack to determine the example home without depending on the CWD // this is needed for example/multicore tests which reside outside the classpath - File base = SolrTestCaseJ4.getFile("solr/conf").getAbsoluteFile(); + File file; + try { + file = new File("solr/conf"); + if (!file.exists()) { + file = new File(Thread.currentThread().getContextClassLoader().getResource("solr/conf").toURI()); + } + } catch (Exception e) { + // If there is no "solr/conf" in the classpath, fall back to searching from the current directory. + file = new File("."); + } + File base = file.getAbsoluteFile(); while (!new File(base, "solr/CHANGES.txt").exists()) { base = base.getParentFile(); }