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

前端 未结 12 981
[愿得一人]
[愿得一人] 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:49

    To solve this problem here is what I did:

  • Install Groovy Monkey for Eclipse
  • Created a Bean Shell Script "UpdateMavenDerived_Beanshell.gm" to mark any directory named target as derived.
  • -----------Cut below here for script--------------

    /*
     * Menu: Find System Prints > Beanshell
     * Script-Path: /GroovyMonkeyScripts/monkey/UpdateMavenDerived_Beanshell.gm
     * Kudos: Bjorn Freeman-Benson & Ward Cunningham & James E. Ervin
     * License: EPL 1.0
     * LANG: Beanshell
     * DOM: http://groovy-monkey.sourceforge.net/update/plugins/net.sf.groovyMonkey.dom
     */
    out.println("Setting target directories to derived status.");
    var projects = workspace.getRoot().getProjects();
    for ( var i = 0; i < projects.length; i++) {
        var project = projects[i];
        if (project.isOpen()) {
            out.println("Project: " + project.getName());
            var members = project.members();
            for ( var j = 0; j < members.length; j++) {
                if (members[j].getName().equals("target")) {
                    out.println("setting derived status on: "+ members[j].getFullPath());
                    members[j].setDerived(true);
                }
            }
        }
    }
    

提交回复
热议问题