Sh*t my brain says and forgets about

Maven & Eclipse target folder + validation stabbyness

Does using Maven with Eclipse make you stabby when you spend an hour waiting for Eclipse to finish validating files? You may not realize it, but Eclipse is indexing/validating files inside of your project’s target folders! Yes kids, this is annoying and time consuming. The target folders also end up showing results in the “Open Type” and “Open Resource” windows. I’m sure we’ve all experienced the duplicate results when searching for a class or resource.

Why does it do this? Eclipse has a feature built in that will, by default, exclude folders that have been marked as “derived”. Normally folders like your source output folders (bin for example) are marked for you. Well, Eclipse doesn’t automatically mark the target folder as “derived” so it treats it like a regular folder. Right click your target folder in Eclipse and click the check box for “derived” – magically the folder is now excluded even from the Open Type and Open Resource windows.

But wait.

Next time you run a Maven “clean”, the target folder is deleted and the check box reset for derived. How do you avoid that? In your parent project (or current project if you have a single module) add the following to your plugin definitions:

[gist id=1801819]

This will force Maven to use version 2.4.1 of the “clean” plugin – if you’re using Maven 3 you can probably remove the version line. After version 2.3 of the plugin, excludeDefaultDirectories became available. This little gem will only delete the target content and leave the folder alone for you.



Resizing a UITextView automatically with the keyboard


Spring 3.1’s PropertyPlaceholderConfigurer


    • Aaron

      I have not tried that – although my focus has primarily been on iOS lately. Thanks for the tip!

Leave a Reply

Your email address will not be published. Required fields are marked *

Powered by WordPress & Theme by Anders Norén