4

enter image description here

I upgraded my Spring Tool Suite today and since then I am stuck on bulding the project correctly. When I Maven->Update Project, it EXCLUDES src/main/resources folder. If I 'Remove' that exclusion (make it 'Excluded(None)'), things works fine. But, when I again do Maven->Update Project, it comes down to this.

I've explored 100's of links but no luck so far. Things were working fine before the update.

How can I get Maven include src/main/resources and src/test/resources?

.classpath file when the resource folders gets included (the one I desire to get generated by default):

<?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 kind="src" output="target/classes" path="src/main/resources">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <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 kind="src" output="target/test-classes" path="src/test/resources">
        <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="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
        <attributes>
            <attribute name="owner.project.facets" value="jst.web"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" path="test">
        <attributes>
            <attribute name="optional" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" path=".apt_generated">
        <attributes>
            <attribute name="optional" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

.classpath file when I do Maven->Update project

<?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">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <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 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="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
        <attributes>
            <attribute name="owner.project.facets" value="jst.web"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" path="test">
        <attributes>
            <attribute name="optional" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" path=".apt_generated">
        <attributes>
            <attribute name="optional" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="target/classes"/>
</classpath>
Anmol Gupta
  • 2,797
  • 9
  • 27
  • 43
  • What happens if you remove the project from Spring Tool Suite (without deleting the files on disk), then removing all Eclipse specific files like `.classpath` and re-import it again as a Maven project? This issue is very weird. Also, are you using the latest M2E? – Tunaki Jun 11 '16 at 20:29
  • Tried delete and re-import several times. It just does the same as soon as project is built/loaded in the workspace. M2E version is 1.7 in my Windows , where this problem is happening. Same project is working fine in Ubuntu where M2E version is 1.5. And it was working fine in windows too until I upgraded Spring tool suite :( – Anmol Gupta Jun 11 '16 at 20:37
  • What does your `pom.xml` look like? Are these resources excluded from your `pom.xml` configuration? – Horsing Jun 12 '16 at 02:40
  • @GeminiKeith No, my pom.xml does not even contain a tag. – Anmol Gupta Jun 12 '16 at 05:46
  • @Tunaki http://stackoverflow.com/questions/7754255/maven-m2eclipse-excludes-my-resources-all-the-time tells that this is the correct behavior! But, I am getting different behaviors with different versions. – Anmol Gupta Jun 12 '16 at 05:47
  • It looks your code is doing something different, cause the exclusion of the `src/main/resources` in the configuration looks ok so far...May be you can show your code...and your pom file – khmarbaise Jun 12 '16 at 09:31
  • @khmarbaise M2E plugin is 1.7 where this is happening (supposedly normal), and its 1.5 where resources is getting included. pom.xml is same in both the cases with absolutely no mention of resources. Update is modifying .classpath file as I've updated in the question. – Anmol Gupta Jun 12 '16 at 19:03

1 Answers1

1

If i take a look at my eclipse configuration this looks exactly like yours with the exclusion.

enter image description here

khmarbaise
  • 92,914
  • 28
  • 189
  • 235