Eclipse 2021-12 新建maven工程后,pom.xml报错
cvc-elt.1.a: Cannot find the declaration of element ‘project’. pom.xml
Description Resource Path Location Type
cvc-elt.1.a: Cannot find the declaration of element 'project'. pom.xml /JavaMavenTest line 1 Language Servers
解决办法:
将默认的
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
换成
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
即里面的xsi:schemaLocation http换成https即可
最新的schemaLocation地址已经是https协议了,调整后报错立即消失了
参考:
Eclipse中maven项目pom文件cvc-elt.1.a: Cannot find the declaration of element 'project’之解决