防止Eclipse从Maven目标文件夹中定位/链接文件

时间:2013-03-12 07:47:19

标签: eclipse maven m2e eclipse-wtp

我正在使用 Maven Eclipse 开发Web应用程序。我还使用 m2e插件及其wtp连接器即时将更改发布到服务器中。这些插件正在Maven的目标文件夹中创建一个文件夹,名为 target / m2e-wtp / web-resources

我的问题是当我从我的项目编辑一个xhtml文件并且有一个指向另一个文件的链接时,当我执行它时,执行 ctrl +点击将我带到这个目标文件夹,当我显然想要进入 webapp 目录中的文件。如果我尝试编辑该文件,Eclipse会警告我这是一个派生文件。

有没有办法避免这个问题?

EDITED

这是我项目的类路径内容:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" output="target/classes" path="src/main/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources/bundles"/>
    <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources/classes/interna"/>
    <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources/hibernate-mappings"/>
    <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources/styles/headers/premium"/>
    <classpathentry excluding="**" including="**/*.java" kind="src" output="target/classes" path="src/main/resources/styles/css/premium"/>
    <classpathentry kind="src" output="target/test-classes" path="src/test/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
            <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

2 个答案:

答案 0 :(得分:1)

我使用工作集从Eclipse视图中排除选定的文件/文件夹。

您可以通过各种方式创建/修改/选择工作集,例如:在Project Explorer的工具栏上,单击“查看菜单”按钮打开显示选项的下拉菜单;在那里,您可以从列表中选择现有的工作集,或者通过选择“新建...”来创建一个新工作集。

答案 1 :(得分:1)

target/m2e-wtp/web-resources文件夹包含“自动生成的资源”,例如过滤的 web.xml,因此webapp目录中的文件(如果有的话)可以不要与Eclipse打开的那个相同。 不过请查看"What is this web resources folder?",特别是"That web resources folder is causing me some trouble, can i get rid of it?"

相关问题