Maven:项目无法产生Maven Dependencies且无法update project报cannot nest错误

找自己出错项目的.classpath文件,打开,ctrl+f,找是否有以下文件,如果没有在末尾加进去,再refresh项目即可:

复制代码
<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>

添加后我的.classpath文件是这样的:

复制代码
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src/main/java"/>
    <classpathentry kind="src" path="src/main/resources"/>
    <classpathentry kind="src" path="src/extend/java"/>
    <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
    <attributes>
        <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
    </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
    <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0 (2)">
    <attributes>
        <attribute name="owner.project.facets" value="jst.web"/>
    </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7">
    <attributes>
        <attribute name="owner.project.facets" value="java"/>
    </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="build/classes"/>
</classpath>

这样项目就没有什么问题了!

项目加载是要读取.classpath文件的,加载不到且Maven不能update project说cannot nest错误。

相关推荐
Tao____2 分钟前
国产开源物联网平台
java·物联网·mqtt·iot·设备对接
uup2 分钟前
RabbitMQ 在 Java 应用中消费者无法连接问题
java·rabbitmq
做cv的小昊6 分钟前
在NanoPC-T6开发板上通过USB串口通信实现光源控制功能
java·后端·嵌入式硬件·边缘计算·安卓·信息与通信·开发
敲代码的嘎仔11 分钟前
LeetCode面试HOT100——160. 相交链表
java·学习·算法·leetcode·链表·面试·职场和发展
敲代码的嘎仔13 分钟前
LeetCode面试HOT100—— 206. 反转链表
java·数据结构·学习·算法·leetcode·链表·面试
雨中飘荡的记忆14 分钟前
设计模式之适配器模式详解
java·设计模式·适配器模式
客梦18 分钟前
数据结构-图结构
java·数据结构·笔记
世界尽头与你18 分钟前
CVE-2020-1938_ Apache Tomcat AJP 文件读取与包含漏洞
java·网络安全·渗透测试·tomcat·apache
n***44318 分钟前
Java进阶:IO大全
java·开发语言·python
Seven9719 分钟前
剑指offer-45、扑克牌顺⼦
java