Is there a way to hide Maven 2 "target/" folder in Eclipse 3?

Viewed 27470

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?

12 Answers

Right click on the folder you want to ignore, open the "Properties" dialog, chose the "Resource" tab and check the box that says "Derived"

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

Preferences > Team > Ignored Resources

Add "target", and restart Eclipse.

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".

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

Related