4

I'm developing a web application using Maven and Eclipse. I'm also using m2e plugin and its wtp connector to publish changes into the server on the fly. These plugins are creating a folder into the Maven's target folder, called target/m2e-wtp/web-resources.

My problem is when I am editing a xhtml file from my project and have a link to another file, when I go through it doing ctrl+click is bringing me to this target folder, when I obviusly want to go to the file which is into webapp directory. If I try to edit the file, Eclipse is warning me that is a derived file.

Is there a way to avoid that issue?

EDITED

That's my project's classpath content:

<?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>
Aritz
  • 30,971
  • 16
  • 136
  • 217

2 Answers2

1

I use a Working Set to exclude selected files/folders from Eclipse views.

You can create/modify/choose a Working Set in various ways, for example: on the toolbar of the Project Explorer, click the "View Menu" button to open the drop-down menu of display options; there you can select an existing working set from the list or create a new one by selecting "New...".

Pino
  • 7,468
  • 6
  • 50
  • 69
  • That could be, however I like having my *target* folder visible in the project in order to maintain control of what the m2e-wtp plugin is deploying to my server... – Aritz Mar 13 '13 at 08:58
  • @Xtreme Biker: Previously I have not read carefully your question. You say you are using ctrl+click, not ctrl-shift-T or ctrl-shift-R (that is the "Open Type" and "Open Resource" dialogues that can be filtered using a Working Set without affecting the Project Explorer). However I have added a different answer, I hope it helps. – Pino Mar 14 '13 at 09:18
1

The target/m2e-wtp/web-resources folder contains "automatically generated resources", for example a filtered web.xml, so the file in the webapp directory (if any) could be not indentical to the one that is opened by Eclipse. However check "What is this web resources folder?" and expecially "That web resources folder is causing me some trouble, can i get rid of it?".

grahamj42
  • 2,752
  • 3
  • 25
  • 34
Pino
  • 7,468
  • 6
  • 50
  • 69
  • 1
    Having read your second link, I want just to give it a try but can't find the *WTP* section under the Maven properties of my project. That happens to me in my both Eclipse installations, *Juno* and *Indigo*. However, if I try ctrl+click in Eclipse Indigo, it gives me the choice between the good file and the targeted one. So the issue only happens with my Juno installation and probably is related with the *JBoss tools* plugin I installed, which has also tools for Maven. Thank you anyway. – Aritz Mar 14 '13 at 10:11