39

How do I exclude a folder AND its sub-directories from validation in eclipse? I know that you can right click on a folder in Package Explorer and select Exclude Validation, but if you have sub-directories under it, you'd have to this for each and it isn't ideal for generated directories or ones with many sub-folders.

Any plug-ins that might be able to do this?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Ayyoudy
  • 3,641
  • 11
  • 47
  • 65

4 Answers4

61

I usually exclude validation in this way, I believe it will be recursive.

  • Right-click on your project and select Properties.
  • Choose Validation from the left-nav menu.
  • If it is not already selected choose "Enable project specific settings".
  • Find the validator that is relevant for what you want to exclude and click the "..." in the Settings column.
  • Highlight the Exclude Group and click Add Rule. (If you don't have any existing exclusions you may have to add an Exclude Group.)
  • Select Folder or file name as the Filter Type.
  • Click Next.
  • Select Browse Folder and find the folder you want to exclude.
Sarah Haskins
  • 1,355
  • 2
  • 16
  • 25
  • 24
    I am using Eclipse Luna and searched for this several hours. The given solution doesn't work for me. I had to open the `Navigator` view and right-click on the desired folder --> properties --> check derived. Hope it will help some onthers. – GuyT Sep 18 '14 at 10:11
  • 1
    It worked for me.. after I clicked on Project -> Clean and the project was rebuilt. – atmelino Jan 20 '15 at 02:49
  • The problem with @GuyT's approach is that the derived flag will vanish, if the folder in question is removed and re-created, which applies to e.g. the `target` folder in a standard java project. That being said, I share his observation that this answer does not help (tried Eclipse Luna 4.4.1 and 4.4.2). – zb226 Jun 03 '15 at 11:39
  • 3
    it is not working... I am not able to select a folder in "Browse Folder..." dialog. After I select a folder and click OK, "File or folder" field remains empty. If I enter folder manually, it is included in validation anyway... – mirec Jul 15 '16 at 07:37
  • Don't forget that within Include / Exclude groups, the rules are alternative, i.e. logical OR, if any rule matches, the group matches. At group level, multiple Include groups are combined, i.e. logical AND, so ALL groups must match. Same principle for Exclude groups. – Adam Aug 03 '16 at 13:33
  • I noticed that checking the *Derived* flag automatically adds a .gitignore file excluding the *Derived* folder (with Git already set up as the SCM, of course). So this might not be viable for projects using version control that ONLY want to exclude folders from validation. – drognisep Jul 09 '17 at 19:55
  • I had to do the things from Sarah Haskins and GuyT above, and also right click on the project and click Validate. Project/Clean and Run As/Maven clean wasn't enough. – ccleve Apr 08 '19 at 15:28
  • 1
    @zb226 There is a lifesaving plugin called "AutoDeriv" which will fix that problem. – user3067860 Jun 16 '22 at 22:07
3

For those PHP developers who coding in Eclipse Mars.

  1. Right click on folder.
  2. choose "Use As Library Folder"

For example in laravel framwork, you can exclude /vendor, /storage and /node_modules folders from eclipse validation.

yyc1217
  • 69
  • 5
  • 1
    "Use as Library folder" makes the project include that folder in all library operations (which makes sense. You *told* it to, after all). But from the same right-click menu you can choose Properties and mark the folder as "Derived". This will exclude *most* validators. – LSerni Jan 24 '17 at 10:18
-1

I'm running Helios SR 1 right now so hopefully this works...

  • Select the Project
    • Right Click
    • Properties
    • Validation Menu -> Enable Project Specific Settings
    • Select the validator in question
    • Select/Deselect the validation for build/manual (or, if it something like the web tools you can configure specific rules by plugin--such as excluding a folder)

Hope that helps, it is by tool.

Arjan
  • 22,808
  • 11
  • 61
  • 71
Daniel B. Chapman
  • 4,647
  • 32
  • 42
-2

I think the best way is:

  • Right click the project
  • Properties
  • Java Build Path
  • "Source" tab
  • Select the folder that contains the file you want to exclude
  • Click the button "Edit..."
  • Next button
  • In the "Exclude patterns" Click "Add..." button
  • Add your filter

The filter can be a single file or multiple files.

Arjan
  • 22,808
  • 11
  • 61
  • 71
jobesu
  • 620
  • 6
  • 7
  • 2
    Doesn't this also remove the file from the build path? For instance, say you have JAXB generated code - you don't want to validate it (and it usually contains many warnings), but you do want it on the build path. – Phil Sep 15 '13 at 22:47