> The layout of sbt projects follows the same pattern of similar maven style project
>
> It's a common practice to put configuration and properties files under /src/{cp}/resources/ (where cp is either main or test) which the copy-resources will copy them to the target directory when building the project. In your source you can reference them as you would any other in a similar mvn project
>
> src
> /main
> /resources
> /config.properties
> /scala
> /Foo.scala
>
> From Foo.scala, you can say getClass().getResourceAsStream("/config.properties") which can be loaded in to a java Properties object or similar config object
This is something I was looking at just today (in the source for net.liftweb.util.Props)
and still don't understand. In the target directory, the structure in the source directory
tree is maintained:
/target/scala_2.8.1
/resources
properties file
/classes
Foo.class
What logic does getResourceAsStream use to navigate "sideways" in the
directory hierarchy to get from /classes to /resources? It seems like the
argument to getResourceAsStream should be "../resources/config.properties"
-- but that's not how it seems to work.
Explanations welcome!
Byron
---------------------------------------------------------
Byron Weber Becker Voice: 519-888-4567 x34661
School of Computer Science Fax: 519-885-1208
University of Waterloo Office: DC3105
Waterloo, ON N2L 3G1
Advising FAQ: http://www.cs.uwaterloo.ca/current/faq/index.shtml