views:

2847

answers:

6

I'm using maven 2.0.9 with Eclipse 3.3.2.

I'm used to launching a fresh build once per day by a mvn clean install. Then, if I refresh my Eclipse project, it will be "polluted" by files from Maven's target directory.

That's very annoying while performing searches, getting resources by "open resource" and so on.

Is there a way to avoid Eclipse looking in this folder?

+1  A: 

Are you using the Maven plugin for Eclipse?

I would imagine it would hide some of the 'pollution' for you.

It would also allow you to perform the build within Eclipse - meaning it would refresh the project view for you at the same time.

Maven 2 Eclipse

James Camfield
No, I'm not using currently the maven plugin for eclipse but I'll try that.
paulgreg
+1  A: 

The maven plugin does not hide away the target directory. It does however use the maven target folders to configure eclipse. So target/classes and target/test-classes are used by eclipse, and eclipse filters these folders out. This is done by "mvn eclipse:eclipse" as well as by the m2eclipse plugin. What is left visible is everything in the target directory besides these two folders (the generated jar file for example).

You can create a filter for the package explorer, but that will not influence the "open resource".

Tobias Schulte
+2  A: 

Did you try configuring the "Java Element Filters" option dialog box, (through the top-right arrow of the project explorer) ?

If needed, you can define your own ViewerFilter

VonC
I tried that several weeks ago but wasn't able to get what I want.
paulgreg
+3  A: 

Right click on the folder you want to ignore, right click and check the box that says "Derived"

That seems to work ! Thanks !
paulgreg
The only problem with this method is that if you ever call maven eclipse:clean, you have to reapply your project changes. =/
Spencer K
Right-click on the folder, then select PROPERTIES, then check "Derived". At least, that's what you have to do with Galileo.
Caffeine Coma
+1  A: 

use m2eclipse.sonatype.org

Brian Fox
+1  A: 

Preferences > Team > Ignored Resources

Add "target", and restart Eclipse.

This only tells your version control to ignore it. No apparent affect on any other operations.
Chris Noe