blob: 3bc09438051a4198b6fef2584bbcd49ad6e3ea87 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import java.nio.file.{Files, Paths}
object Main extends App {
// Be aware that CBT currently isolates classloaders of dependencies
// your dependencies will not see the resources of your project
// This means that e.g. spray will not see a application.conf in your project's
// resources/ directory. See https://github.com/cvogt/cbt/issues/176
println(
"foo.text in resources contains: " ++
new String(
Files.readAllBytes(
Paths.get( getClass.getClassLoader.getResource("foo.text").getFile )
)
)
)
import scala.collection.JavaConverters._
println(
"foo.text in resources and my-resources:\n" ++
getClass.getClassLoader.getResources("foo.text").asScala.map(
resource =>
new String(
Files.readAllBytes(
Paths.get( resource.getFile )
)
)
).mkString
)
}
|