The good people at JetBrains helped me out on this one, so I thought I'd share it here.
To copy Java project resources to a directory relative to the project output directory (where the .class files go by default), use the Relative Output Path for the directory marked as your resources directory.
https://www.jetbrains.com/help/idea/content-roots.html
For example, let's suppose you have a Java project and you put your classes into a package called org.acme. Let's also assume your resources are in a resources/ directory and that your project's output directory is called target/.
What will happen by default is that your .class files will end up in target/org/acme/, but your resources will end up in target/. If you want to copy your resources to the same place as your .class files (it makes loading them easier at times), you can set your Relative Output Path to org/acme/
In the IntelliJ IDE, from the main menu:
- File -> Project Structure
- Select Modules from the left-hand pane
- Select Sources from the main panel
- Select your resources/ directory
- Click on the pencil icon next to the resources directory
- Add your Relative Output Path
Next time the project builds, the resources will be copied to this relative path under the primary output directory.
I hope this was useful!
John