我正在使用 Maven 和 Eclipse 开发网络应用程序。我还使用 m2e 插件 及其 wtp 连接器将更改即时发布到服务器。这些插件在 Maven 的目标文件夹中创建一个名为 target/m2e-wtp/web-resources 的文件夹。
我的问题是,当我从我的项目中编辑一个 xhtml 文件并有一个指向另一个文件的链接时,当我通过 ctrl+click 将我带到这个目标文件夹时,当我显然想转到 webapp 目录中的文件。如果我尝试编辑该文件,Eclipse 会警告我这是一个派生文件。
有没有办法避免这个问题?
已编辑
这是我项目的类路径内容:
<?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>
最佳答案
我使用 Working Set 从 Eclipse View 中排除选定的文件/文件夹。
您可以通过多种方式创建/修改/选择一个Working Set,例如:在Project Explorer的工具栏上,点击“View Menu”按钮,打开显示选项的下拉菜单;在那里,您可以从列表中选择一个现有的工作集,或者通过选择“新建...”来创建一个新的工作集。
关于eclipse - 防止 Eclipse 从 Maven 目标文件夹定位/链接文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15355814/