eclipse新建maven项目出错 pom.xml报错
问题:
1.新建项目后会提示一个这样的错
maven-compiler-plugin:3.1:compile(1 errors)
maven-compiler-plugin:3.1:testCompile(1 errors)
2.关掉后看pom.xml
3.plugin标签也报错,无法解析
鼠标放红叉上提示
错误:
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to read artifact
descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1: UnresolvableModelException: Failure to transfer org.apache.maven:maven-parent:pom:23 from http://maven.aliyun.com/
nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced. Original error: Could
not transfer artifact org.apache.maven:maven-parent:pom:23 from/to alimaven (http://maven.aliyun.com/nexus/content/groups/public/): sun.security.validator.ValidatorException: PKIX path
building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (execution: default-testCompile, phase: test-compile)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (execution: default-compile, phase: compile)
descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1: UnresolvableModelException: Failure to transfer org.apache.maven:maven-parent:pom:23 from http://maven.aliyun.com/
nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced. Original error: Could
not transfer artifact org.apache.maven:maven-parent:pom:23 from/to alimaven (http://maven.aliyun.com/nexus/content/groups/public/): sun.security.validator.ValidatorException: PKIX path
building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (execution: default-testCompile, phase: test-compile)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (execution: default-compile, phase: compile)
解决:
排查eclipse配置maven的地方,和配置的仓库都没问题
再排查settings.xml,可以尝试更换镜像的配置,但我不是这个问题(可以换成下面这个,是我成功后的)
<mirrors> <mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors>
因为错误是说解析不了plugin,我猜想是上次更新时强制关闭eclipse导致某些包没更新好,然后导致版本问题之类的总之无法解析出来报错,就重新换了一个仓库,就成功了
我认为应该是你自己的maven仓库里\org\apache\maven目录下的一些关于plugin的包受损了 ,也可以尝试只更换别人好的maven文件夹,或者全部删掉plugin的相关包重新下载