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

前端 未结 12 971
[愿得一人]
[愿得一人] 2021-01-30 04:58

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,

相关标签:
12条回答
  • 2021-01-30 05:39

    Using Resource filter looks solve issue if you using 'mvn clean install' frequently.

    Basically it will add 'target' to and sub folders to exclude folder directly to .project file. After run this script, if you import project to eclipse, you can see the setting 'Project'->'Properties'->'Resource'->'Resource Filters'. Before this whenever I run mvn clean install, eclipse took 50% of my CPU but now it stay under 5% while build project.


    function eclipse-setup() {
         mvn eclipse:clean
         mvn eclipse:eclipse
         #maven target folders
         find . -name .project -exec sed -i.MSORG 's/<\/projectDescription>/<filteredResources> <filter> <id>1314376338264<\/id> <name><\/name> <type>26
    <\/type> <matcher> <id>org.eclipse.ui.ide.multiFilter<\/id> <arguments>1.0-name-matches-false-false-target<\/arguments> <\/matcher> <\/filter> <filt
    er> <id>1314387234341<\/id> <name><\/name> <type>6<\/type> <matcher> <id>org.eclipse.ui.ide.multiFilter<\/id> <arguments>1.0-name-matches-false-fals
    e-*.cache.html<\/arguments> <\/matcher> <\/filter> <\/filteredResources><\/projectDescription>/' {} \;
    
    }
    
    0 讨论(0)
  • 2021-01-30 05:41

    When Eclipse freezes, looking at the process activity, I can see it browsing all my target, .hg and .git directories. Moreover, those directories are also copied into Eclipse's bin directory. A lot of CPU and disk usage for nothing.

    Not cleaning the target directory is not an acceptable solution.

    There was a solution using a Monkey script (http://maven.40175.n5.nabble.com/Eclipse-amp-target-directory-td72354.html) but the project has been closed.

    I still look for a solution to tell Eclipse to ignore Maven target directories, as well as .hg and .git directories.

    Eclipse continuously watching those is a pain.

    I also use m2eclipse but it doesn't solve that issue.

    0 讨论(0)
  • 2021-01-30 05:42

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

    0 讨论(0)
  • 2021-01-30 05:44

    I have been so pissed by this problem that I wrote a plugin to solve it. You get get the source and jar from:

    https://github.com/YA2O/Eclipse_Plugin_Target_Derivator

    0 讨论(0)
  • 2021-01-30 05:44

    Preferences > Team > Ignored Resources

    Add "target", and restart Eclipse.

    0 讨论(0)
  • 2021-01-30 05:48

    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

    0 讨论(0)
提交回复
热议问题