How to add non-source folders to IntelliJ IDEA project

This is not a strict answer to the question, but it worked for me so I’m posting, perhaps someone will find this useful.

If you want to add an arbitrary folder to your project (even from some different location than your projects), just add it as a module. You needn’t worry about the type so much e.g. I needed to add a folder with some SQL scripts, I added it as a Java module and it’s nicely visible in IntelliJ even though it has no maven structure or Java sources.

This is how to do it:

  • File > Project Structure > Modules
  • Add > New Module > … (e.g. Java Module)
  • In the new module settings mark the subfolders that you want to see as ‘Sources’

Voilà! 🙂

Leave a Comment