Java EclipseMaven:更新项目将src/main/resources文件夹从构建路径中排除

Java EclipseMaven:更新项目将src/main/resources文件夹从构建路径中排除,java,eclipse,spring,maven,spring-tool-suite,Java,Eclipse,Spring,Maven,Spring Tool Suite,我今天升级了我的Spring工具套件,从那以后我就一直坚持正确地构建项目。当I Maven->updateproject时,它排除src/main/resources文件夹。如果我“删除”该排除(使其为“排除(无)”,则一切正常。但是,当我再次执行Maven->Update项目时,问题就归结到了这一点 我已经探索了100个链接,但到目前为止没有运气。在更新之前一切正常 如何让Maven包含src/main/resources和src/test/resources 包含资源文件夹时的.classp

我今天升级了我的Spring工具套件,从那以后我就一直坚持正确地构建项目。当I Maven->updateproject时,它排除src/main/resources文件夹。如果我“删除”该排除(使其为“排除(无)”,则一切正常。但是,当我再次执行Maven->Update项目时,问题就归结到了这一点

我已经探索了100个链接,但到目前为止没有运气。在更新之前一切正常

如何让Maven包含src/main/resources和src/test/resources

包含资源文件夹时的.classpath文件(默认情况下我希望生成的文件):


.classpath文件,当我执行Maven->Update项目时

<?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>

如果我看一下我的eclipse配置,它看起来和您的完全一样,只是有例外


如果从Spring工具套件中删除项目(不删除磁盘上的文件),然后删除所有Eclipse特定的文件,如
.classpath
,并将其作为Maven项目重新导入,会发生什么?这个问题很奇怪。此外,您是否正在使用最新的M2E?尝试了多次删除和重新导入。只要在工作区中构建/加载项目,它就会执行相同的操作。在我的Windows中,M2E版本是1.7,这个问题就是在这里发生的。同样的项目在Ubuntu中运行良好,M2E版本为1.5。在我升级Spring工具套件之前,它在windows中也运行良好:(您的
pom.xml
看起来像什么?这些资源是否从您的
pom.xml
配置中排除?@GeminiKeith否,我的pom.xml甚至不包含标记。@Tunaki告诉我这是正确的行为!但是,我在不同的版本中获得了不同的行为。使用.classpath文件更新了问题。)
<?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>