Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add non-source folders to IntelliJ IDEA project

Recently set up a multi module project in IntelliJ with the following structure:

/module1 /module2 /web-module /sql /lib /a few more folders 

I set up module1+2 and web-module as modules in IntelliJ so those show up, but how do you make the sql and lib folder show up in the project panel? They should be included in VCS as well, but IntelliJ ignores them. How do you add folders outside modules to a project?

Screenshot of project and explorer view:

like image 295
Rasmus Franke Avatar asked Aug 30 '12 08:08

Rasmus Franke


People also ask

How do I add folders to IntelliJ project?

In the Project tool window ( Alt+1 ), right-click the node in which you want to create a new directory and select New | Directory. Alternatively, select the node, press Alt+Insert , and click Directory. Name the new directory and press Enter .

How do I add an external library to IntelliJ?

From the main menu, select File | Project Structure | Project Settings | Modules. Select the module for which you want to add a library and click Dependencies. button and select Library. In the dialog that opens, select a project or a global library that you want to add to the module.

How do I add excluded files in IntelliJ?

add files to exclude... right click directory > mark directory as excluded... If you want to add or remove files from that directory reverse the process... cancel exclusion on the directory, get/put files...

How do I create a external class folder in IntelliJ?

For the newer versions of Intellij, press Ctrl + Alt + Shift + s to open project settings, then choose Modules, under Dependencies tab choose the green + and add the folder in which your . class file is located.


1 Answers

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à! :)

like image 147
machinery Avatar answered Sep 28 '22 16:09

machinery