IntelliJ not seeing resources folder

后端 未结 5 755
忘了有多久
忘了有多久 2021-02-13 15:04

I created a new Project from scratch in IntelliJ by using a Maven Module. I didn\'t select any specific archetypes and I clicked on finish. The project gets created

相关标签:
5条回答
  • 2021-02-13 15:30

    Had similar issue. Solution that worked for me:

    ClassLoader classLoader = getClass().getClassLoader();
    File file = new File(classLoader.getResource("path").getFile());
    
    0 讨论(0)
  • 2021-02-13 15:31

    There is a bug in Intellij 12 please go to Settings->Compiler and un-check "Use external build" check box - the idea behind it was that it was suppose to run faster with a compiler run in a separate process but in fact there is a bug and when using maven it does not copy resources.

    0 讨论(0)
  • 2021-02-13 15:40

    try

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*</include>
        </includes>
      </resource>
    </resources>
    

    or under settings -> compiler -> resource patterns, add the resource pattern (i.e ?*.prefs)

    0 讨论(0)
  • 2021-02-13 15:44

    Well the answer is quite simple ..!
    Just reference the file path in your source code as below:

    src\\main\\resources\\FileName

    & it should work as expected.

    0 讨论(0)
  • 2021-02-13 15:50

    Right Click the Directory -> "Mark Directory as" -> "Resource Root"

    0 讨论(0)
提交回复
热议问题