mirror of https://github.com/sbt/sbt.git
Replace getResource("") trick
Fixes https://github.com/sbt/sbt/issues/5339 It seems like some tests are using `ClassLoader#getResource("")` to acquire the `classes` directory path. This does not seem to work on sbt 1.3.6, which returns `file:/home/travis/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar!/META-INF/versions/9/`. To workaround this issue, I've switched to loading the known folder name instead.
This commit is contained in:
parent
d21d698e96
commit
a8ab4ada68
|
|
@ -19,7 +19,7 @@ class ErrorSpec extends AbstractSpec {
|
||||||
"Parser " should {
|
"Parser " should {
|
||||||
|
|
||||||
"contains file name and line number" in {
|
"contains file name and line number" in {
|
||||||
val rootPath = getClass.getClassLoader.getResource("").getPath + "/error-format/"
|
val rootPath = getClass.getResource("/error-format/").getPath
|
||||||
println(s"Reading files from: $rootPath")
|
println(s"Reading files from: $rootPath")
|
||||||
foreach(new File(rootPath).listFiles) { file =>
|
foreach(new File(rootPath).listFiles) { file =>
|
||||||
print(s"Processing ${file.getName}: ")
|
print(s"Processing ${file.getName}: ")
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class NewFormatSpec extends AbstractSpec {
|
||||||
|
|
||||||
"New Format " should {
|
"New Format " should {
|
||||||
"Handle lines " in {
|
"Handle lines " in {
|
||||||
val rootPath = getClass.getClassLoader.getResource("").getPath + "/new-format/"
|
val rootPath = getClass.getResource("/new-format").getPath
|
||||||
println(s"Reading files from: $rootPath")
|
println(s"Reading files from: $rootPath")
|
||||||
val allFiles = new File(rootPath).listFiles.toList
|
val allFiles = new File(rootPath).listFiles.toList
|
||||||
foreach(allFiles) { path =>
|
foreach(allFiles) { path =>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import scala.io.Source
|
||||||
import SessionSettings.SessionSetting
|
import SessionSettings.SessionSetting
|
||||||
|
|
||||||
abstract class AbstractSessionSettingsSpec(folder: String) extends AbstractSpec {
|
abstract class AbstractSessionSettingsSpec(folder: String) extends AbstractSpec {
|
||||||
protected val rootPath = getClass.getClassLoader.getResource("").getPath + folder
|
protected val rootPath = getClass.getResource("/" + folder).getPath
|
||||||
println(s"Reading files from: $rootPath")
|
println(s"Reading files from: $rootPath")
|
||||||
protected val rootDir = new File(rootPath)
|
protected val rootDir = new File(rootPath)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue