Search code examples
intellij-idearesourcebundle

intellij and ResourceBundle


I try to run tests from Intellij. Methods I test uses some properties files from src/main/resources but seems like they are ignored when I run it as JUnit test. It works when I run it from eclipse and ant but not from Intellij. How can I make my src/main/resources visible for tests in Intellij? Dont know if it matters but test and main folders are treated like separated modules in my project view.


Solution

  • Verify that src/main/resources is set as Sources or as Test Sources in the project structure. Resources from such folders are copied to the output path (classpath) automatically according to Settings | Compiler | Resource Patterns.