This is my folder structure and I am trying to load the "grammar.txt" file from resources folder but I get not found error.
val source = Source.fromResource("grammar.txt")
Folder structure:
➜ cfg-tools tree -L 4
.
├── build.sbt
├── src
│ ├── main
│ │ └── scala
│ │ ├── Builer.scala
│ │ ├── Driver.scala
│ │ ├── tokens.scala
│ │ └── Tools.scala
│ ├── resources
│ │ └── grammar.txt
build.sbt
name := "cfg-tools"
version := "0.1"
scalaVersion := "3.0.2"
Compile / unmanagedResourceDirectories = sourceDirectory.value / "resources"
CodePudding user response:
You don't need the custom SBT configuration: just use the standard place for resources which is src/main/resources
(note that it's in main
subfolder compared to your current structure).