![](/img/trans.png)
[英]How can I access sub-projects of an sbt-plugin by using it as dependency in a multi-project build?
[英]How to access sbt-plugin-project resource from sbt-plugin during a build?
我有一個看起來像這樣的sbt插件項目
/
src/
main/
resources/
hello.txt/
Build.scala
我想在構建時加載hello.txt
以便用它來做事。 但是,當我嘗試加載資源(或一般的其他文件)時,我只能從我正在構建的項目中加載資源,而不是從插件項目中加載資源。 在構建期間有沒有辦法引用hello.txt
? 我的另一種方法是將hello.txt
復制到源代碼中的一個大的多行字符串中,但這感覺很hello.txt
。
使用getClass.getClassLoader.getResourceAsStream("hello.txt")
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.