Maven导入Servlet出错Cannot resolve javax.servlet:javax.servlet-api:pom:3.1.0 failed to transfer from htt

导入pom.xml配置

此处是成功的图片,开始时3.1.0爆红,通常情况下点击刷新是会解决问题的,但是此处点击右上刷新依旧爆红有错
Maven导入Servlet出错Cannot resolve javax.servlet:javax.servlet-api:pom:3.1.0 failed to transfer from htt_第1张图片

完整错误

Cannot resolve javax.servlet:javax.servlet-api:pom:3.1.0 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact javax.servlet:javax.servlet-api:pom:3.1.0 from/to central (https://repo.maven.apache.org/maven2): transfer failed for https://repo.maven.apache.org/maven2/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.pom

然后去翻译了一波:
Maven导入Servlet出错Cannot resolve javax.servlet:javax.servlet-api:pom:3.1.0 failed to transfer from htt_第2张图片
看到翻译猜测是本地缓存的原因
在Idea中查找到Maven的仓库目录:
Maven导入Servlet出错Cannot resolve javax.servlet:javax.servlet-api:pom:3.1.0 failed to transfer from htt_第3张图片
找到我们需要导入的java.servlet-api.3.1.0,查看是否其中有缓存文件,此处是已经成功导入的图片,缓存已经被删除掉了
Maven导入Servlet出错Cannot resolve javax.servlet:javax.servlet-api:pom:3.1.0 failed to transfer from htt_第4张图片
缓存文件:lastUpdated结尾的文件,将它删除掉,然后重新点击Maven的刷新按钮,错误解决
在这里插入图片描述

你可能感兴趣的:(工具,servlet,maven,java)