17

I have a 'logs' directory on the same level as my project is and Intellij Idea, and I can open these logs from Idea. Files in this directory are a couple of gigs, so when I try to search a string in a project it results into a minute or so search, whereas I expect it to be instant. So I mark it as 'Excluded' in Idea.

The problem is that every time there is a change to pom and project is reloaded, I need to mark this dir as 'Excluded' again. So it's becoming a bit annoying because sometimes I forget to do this.

There is a similar question: Exclude folder in intellij idea using Maven. However I'm not using this plugin, because it would be easier for me to always mark this folder as Excluded in Idea on every pom change.

Community
  • 1
  • 1
Andrey Chaschev
  • 16,160
  • 5
  • 51
  • 68
  • @rmg Have you checked this: http://stackoverflow.com/questions/6535288/disable-intellij-indexing-on-specific-folder – assylias Jun 04 '15 at 12:07
  • @assylias: Thanks for the suggestion. Currently all our project information is included in the POM, so we'd like to somehow keep our exclusions there as well. Otherwise, for example, when a new person imports the pom.xml to create a project, it won't be done, and sometimes IntelliJ even hangs indexing the huge folders before there is time to mark them excluded. – Ryan Gabbard Jun 04 '15 at 16:11

4 Answers4

12

Go to Settings/File Types and in the bottom you will see ignore files & folders field. Use ; as delimiter and write files and folders you want to omit from idea processing. But doing so you will lose ability to edit or see this files/folders using idea.

Aliaksei Yatsau
  • 749
  • 7
  • 12
  • This solution is receiving the bounty because it works for our particular situation, although there appears to be no general solution to the problem. We have a common IntelliJ settings JAR shared by all developers and the problematic directories all have shared and distinctive names, so by adding these to the shared settings we can eliminate the problem. – Ryan Gabbard Jun 10 '15 at 15:07
  • Where is Settings|File Types? Which *Settings* are you referring to here - it is not a top-level menu option. – WestCoastProjects Jul 22 '15 at 14:11
  • `Alt+Ctrl+S` or `Alt+F, Alt+T` or `Ctrl+Shift+A` and write settings. Choose whatever you like. – Aliaksei Yatsau Jul 23 '15 at 18:20
4

Simplest solution is to move logs folder to target/logs.

MariuszS
  • 30,646
  • 12
  • 114
  • 155
2

Report a bug, unless you reimport(not reload) the project, those excluded folders should be still excluded (at least mine are in IJ 14.1.4).

Meo
  • 12,020
  • 7
  • 45
  • 52
  • Thanks for the comment. I am afraid these projects are frequently reimported from the pom files by various users (the IDEA projects are not checked in to version control). – Ryan Gabbard Jun 08 '15 at 16:23
  • If you want it excluded after reimport, then you have to use a maven plugin for that. But you wrote that you do not want to use it because you are only concerned about yourself. So what exactly is the use case? – Meo Jun 08 '15 at 21:06
  • In our case, different developers in our group use different IDEs, so we use the `pom.xml` exclusively as our project representation and do not check in any IDE-specific projects. I would ideally like the right thing to be automatically done for new developers using IntelliJ who check out the project and import the POM. – Ryan Gabbard Jun 10 '15 at 15:05
  • And how is the problem solved for other IDEs? Is there something in your pom which excludes it for Eclipse or Netbeans? – Meo Jun 10 '15 at 22:09
1

Maybe a good idea is to not have that log directory in your project at all. Why don't you log somewhere else in your file system. For example:

~/logs/myapp

In my opinion maven does not need to care where the logs are or are not. Just log somewhere else outside of your project. In a prod environment you could do the same, just tell your system admins to create a directory structure where the logs will go and always send your logs there instead of in the project directory.

javing
  • 12,307
  • 35
  • 138
  • 211