有没有办法隐藏Eclipse 3中的Maven 2"target /"文件夹?

pau*_*reg 48 java eclipse maven-2

我在Eclipse 3.3.2中使用maven 2.0.9.

我习惯于每天推出一次新的版本mvn clean install.然后,如果我刷新我的Eclipse项目,它将被来自Maven 目标目录的文件"污染" .

在执行搜索,通过"开放资源"等获取资源时,这非常烦人.

有没有办法避免Eclipse在这个文件夹中查找?

小智 57

右键单击要忽略的文件夹,打开"属性"对话框,选择"资源"选项卡,然后选中"派生"复选框.

  • 右键单击该文件夹,然后选择PROPERTIES,然后选中"Derived".至少,这就是你与伽利略所做的事情. (6认同)
  • 这种方法唯一的问题是,如果你曾经调用maven eclipse:clean,你必须重新应用你的项目更改.= / (5认同)

Mar*_*arx 25

在Maven中重新配置"clean"不要删除目标目录:

<plugin>
    <artifactId>maven-clean-plugin</artifactId>
    <configuration>
        <excludeDefaultDirectories>true</excludeDefaultDirectories>
        <filesets>
            <!-- delete directories that will be generated when you 
                 start the develpment server/client in eclipse  
            -->
            <fileset>
                <directory>target</directory>
                <includes>
                    <include>**/*</include>
                </includes>
            </fileset>
        </filesets>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

(见:http://maven.40175.n5.nabble.com/how-to-NOT-delete-target-dir-td3389739.html#a3413930)

  • 这完成了Zack的答案(投票最多).如果没有这种解决方法,该解决方案将毫无用处.效果很好.不幸的是,必须为每个项目设置它. (5认同)

Mik*_*e R 16

靛蓝解决方案[SR2]

Project Explorer> Customize View> Filters>[*] Maven Build Folder


小智 10

我一直对这个问题很生气,我写了一个插件来解决它.您可以从以下位置获取源和jar:

https://github.com/YA2O/Eclipse_Plugin_Target_Derivator

  • 你的插件很棒.我只是将https://github.com/YA2O/Eclipse_Plugin_Target_Derivator/tree/master/plugins删除到eclipse/dropins /文件夹中,并且必须将*.jar/icons/Pointy.gif修改为较小的一个.它使工具栏高度太大. (2认同)

Jam*_*eld 1

您是否使用 Eclipse 的 Maven 插件?

我想它会为你隐藏一些“污染”。

它还允许您在 Eclipse 中执行构建 - 这意味着它会同时为您刷新项目视图。

Maven 2 日食