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错误。

相关推荐
惊讶的猫1 天前
探究StringBuilder和StringBuffer的线程安全问题
java·开发语言
jmxwzy1 天前
Spring全家桶
java·spring·rpc
Halo_tjn1 天前
基于封装的专项 知识点
java·前端·python·算法
Fleshy数模1 天前
从数据获取到突破限制:Python爬虫进阶实战全攻略
java·开发语言
像少年啦飞驰点、1 天前
零基础入门 Spring Boot:从“Hello World”到可上线的 Web 应用全闭环指南
java·spring boot·web开发·编程入门·后端开发
苍煜1 天前
万字详解Maven打包策略:从基础插件到多模块实战
java·maven
有来技术1 天前
Spring Boot 4 + Vue3 企业级多租户 SaaS:从共享 Schema 架构到商业化套餐设计
java·vue.js·spring boot·后端
东东5161 天前
xxx医患档案管理系统
java·spring boot·vue·毕业设计·智慧城市
一个响当当的名号1 天前
lectrue9 索引并发控制
java·开发语言·数据库
进阶小白猿1 天前
Java技术八股学习Day30
java·开发语言·学习