简体   繁体   English

Eclipse-Maven:更新项目从构建路径中排除 src/main/resources 文件夹

[英]Eclipse-Maven: Updating project excludes src/main/resources folder from build path

在此处输入图片说明

I upgraded my Spring Tool Suite today and since then I am stuck on bulding the project correctly.我今天升级了我的 Spring Tool Suite,从那以后我一直坚持正确构建项目。 When I Maven->Update Project, it EXCLUDES src/main/resources folder.当我 Maven->Update Project 时,它排除了 src/main/resources 文件夹。 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.但是,当我再次执行 Maven->Update Project 时,它归结为这一点。

I've explored 100's of links but no luck so far.我已经探索了 100 个链接,但到目前为止还没有运气。 Things were working fine before the update.更新前一切正常。

How can I get Maven include src/main/resources and src/test/resources?如何让 Maven 包含 src/main/resources 和 src/test/resources?

.classpath file when the resource folders gets included (the one I desire to get generated by default):包含资源文件夹时的 .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 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当我执行 Maven->Update 项目时的 .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>

If i take a look at my eclipse configuration this looks exactly like yours with the exclusion.如果我看一下我的 eclipse 配置,它看起来和你的完全一样,但排除了。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法从 src/main/resources Java 项目 Maven 获取文件夹 - cannot get folder from src/main/resources Java project Maven 从Maven项目资源文件夹(src / main / resources)加载excel(.xlsx / .xls)文件 - Loading an excel(.xlsx/.xls) file from maven project resources folder (src/main/resources) Eclipse-Maven复杂项目依赖关系(ApacheJena) - Eclipse-Maven Complex Project Dependency (ApacheJena) 创建新的Maven项目时出现Eclipse-Maven项目错误 - Eclipse-maven project error when creating a new maven project eclipse-maven项目-NoClassDefFoundError从eclipse运行,但从命令行运行良好 - eclipse-maven project - NoClassDefFoundError running from eclipse but runs fine from command line Eclipse 没有像我在其他地方看到的那样在我的 maven 项目中显示 src/main/resources - Eclipse doesn't show src/main/resources in my maven project the way I see it elsewhere 我的 eclipse maven 项目中没有 java 资源文件夹 - There is no java resources folder in my eclipse maven project Eclipse 中 Maven 项目的类路径 - src vs src/main/java - Classpath for Maven project in Eclipse - src vs src/main/java Maven项目不会将文件放在classpath的src / main / resources中 - Maven project doesn't put files in src/main/resources on classpath 如何获取 src/main/resources 文件夹中文件的路径? - How to get the path to a file in src/main/resources folder?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM