reinclude excluded file in Intellij
Intellij IdeaIntellij Idea Problem Overview
In Intellij, if I have an error in a source file, then when building I can choose "Exclude from Compile"
by right-clicking on the file in the build output.
But, now I would like to include the file again. Where is the menu item that lets me put it back into the build? (The file shows in the Project window, and has a small 'x'
in its icon to show it is excluded, but I see no way to get this to go away.)
Edit - I found there is a compiler.xml
file, and I found I can delete the file from the "excludeFromCompile"
section, but still, there must be a menu item somewhere to do this.
Intellij Idea Solutions
Solution 1 - Intellij Idea
Settings
| Compiler
| Excludes
.
Solution 2 - Intellij Idea
For Intellij 14.0 on Windows, undo excludes from compilation
File -> Settings
Then inside Settings -> Build, Execution, Deployment -> Compiler -> Excludes
or just search for "excludes" to find it.
Solution 3 - Intellij Idea
Note in IDEA v12, there is no longer a File | Settings menu option. I'm not sure how to exclude/re-include individual files, but this is how it works for folders...
Now the menu item is File | Project Structure... and that brings up a multi-column dialog. In the rightmost column, click Modules, then select the directory that contains the excluded folder in the second column. If it is a folder you are trying to re-include, it is listed in the third column's directory list, and excluded folders are at the bottom, in red. If you click on the red 'X' to the right of the folder name, it will remove the folder from the "excluded" list which has the effect of including it back in the project. Awkward and counter-intuitive, but that's how it works.
Solution 4 - Intellij Idea
I found that johnkaplantech's answer didn't work because Idea would complain about multiple modules sharing the same root.
So I manually edited the project files to remove the exclusion. File modified was %ProjectRoot%/.idea/modules/<ModuleName>.iml
. Inside module/component/content
of this XML file was a tag excludeFolder
. Remove that.
Solution 5 - Intellij Idea
In IntelliJ IDEA 15.0.3 File | Settings | Build, Execution, Deployment | Compiler | Excludes | (Remove path from right list).
Solution 6 - Intellij Idea
For Mac it would be :
- Go to Preferences:
-
Expand
Build, Execution,Deployment
section -
Expand
Compiler
sub section -
All the excluded classes will be available in the
Excludes
- Delete the classes you want include for compilation and press Ok. Hope it helps.
Solution 7 - Intellij Idea
From menu: File | Settings | Compiler | Excludes: you can add/remove excluded files to be compiled in the dialog.
Solution 8 - Intellij Idea
For me excluded folders did not appear neither under File > Settings> Compiler > Excludes nor File > Project Structure > Modules > Sources > Exclude.
What I did was: I clicked on the excluded folder with right-click of the mouse. In the menu which opened there is an option "Mark Directory as". I chose "Not Excluded".
Solution 9 - Intellij Idea
A simple workflow is to create a directory in your project and exclude the entire directory.. For example, create a directory called, 'excluded'... 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... mark as excluded again.
Solution 10 - Intellij Idea
To configure classes to be excluded from import open:
- Editor / General node, then click Auto-Import.
This works for me. You can also find this in the documentation:
Solution 11 - Intellij Idea
IntelliJ was still excluding a file after I removed it from the compiler exclude folder. It turns out I had also excluded it in File > Project Structure > Modules > Sources > Exclude files (at the bottom of the window).