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.
使用getClass.getClassLoader.getResourceAsStream("hello.txt")
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.