IntelliJ can't find classpath test resource

后端 未结 7 864
你的背包
你的背包 2020-12-02 14:18

I\'m having a problem where IntelliJ 13.1.4, when running a unit test, can\'t find a ServiceLoader file in the src/test/resources directory of my m

7条回答
  •  情深已故
    2020-12-02 14:51

    I face a similar issue with IntelliJ 14. Despite having the necessary files in my resources folder and ensuring that the folder is specified as a resource in the module settings, IntelliJ intermittently fails to load my files onto the classpath.

    One workaround is to add the required folder as a dependency for the module in the module settings.

    First, click on the "+" button to add a new dependency.

    Then, select the folder you wish to add to the classpath.

    Then select the "classes" option.

    Once that is done, re-build your module once and hopefully that should do the trick.

    Ideally this should not at all be an issue. All files in the resource folder should directly be put in the classpath. However, every IDE has it's quirks.

提交回复
热议问题