我的IntelliJ 12目錄結構:如何將包標記爲資源文件夾?
...
...test
- java
- com.mycompany.myproject
- package1 (contains code, etc,.)
- resourcePackage (want to contain .json files but can't mark as a resource)
- myOtherJunk.json
- o o o
- resources
- aResource.json
的事情是,如果我右鍵點擊我的包名(com.mycompany.myproject)我只能添加包和不目錄(像現有的資源文件夾)。
但是,我不想使用那個現有的資源文件夾作爲我要讀入我的測試類的.json文件。
所以,我需要一些東西來支持:
// this already works for the resources directory per the .json file but doesn't for the
// myOtherJunk.json per the resourcePackage.
InputStream is = MyClassTest.class.getResourceAsStream("aResource.json");
很酷謝謝你! – JaJ
@Funktik描述的這個「項目設置」菜單位於文件菜單下的「項目結構菜單」中(至少在IntelliJ 15中)。 –