I have an sbt plugin project that looks like this
/
src/
main/
resources/
hello.txt/
Build.scala
I would like to load hello.txt
at build time in order to do stuff with it. However, when I try loading resources (or other files in general), I can only load resources from the project I'm building, and not from the plugin project. Is there any way to refer to hello.txt
during the build? My alternative is to copy out hello.txt
into one big multiline-string in the source code, but that feels gross.
Use getClass.getClassLoader.getResourceAsStream("hello.txt")
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With