Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to exclude a file from the content root in IntelliJ?

I want to exclude individual .java files from a Content Root in IntelliJ. The documentation on "Excluding Files from Project" suggests that this is not possible (it explicitly says This action is not applicable to Java files and binaries.)

Being incredulous to such a limitation, I have tried editing my .iml file, optimistically inserting XML elements such as <excludeFile> under the <content> element, but nothing seems to take.

Does anyone know a way to do this (documented or otherwise)? Or have any clue why this feature is not supported? By comparison, Eclipse allows for an arbitrary including pattern for a <classpathentry> element in its .classpath file.

like image 497
bolinfest Avatar asked Aug 13 '12 16:08

bolinfest


People also ask

What are .IML files in IntelliJ?

A module file (the . iml file) is used for keeping module configuration. Modules allow you to combine several technologies and frameworks in one application. In IntelliJ IDEA, you can create several modules for a project and each of them can be responsible for its own framework.


1 Answers

You can exclude files from compilation and classpath. As far as I understand it will have the same effect as manipulating with <classpathentry> in Eclipse.

To exclude files/folders by pattern and globally use Ignore files and folders option in the File Types dialog. This way the files will be completely ignored and not visible in the Project View, but it's probably not what you want.

like image 108
CrazyCoder Avatar answered Sep 28 '22 06:09

CrazyCoder