创建maven项目后pom.xml报错

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了创建maven项目后pom.xml报错相关的知识,希望对你有一定的参考价值。

Multiple annotations found at this line:
- Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.5:resources failed: Plugin org.apache.maven.plugins:maven-
resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:
2.5 () (org.apache.maven.plugins:maven-resources-plugin:2.5:resources:default-resources:process-resources)
- Execution default-testResources of goal org.apache.maven.plugins:maven-resources-plugin:2.5:testResources failed: Plugin
org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: The following artifacts could not be resolved:
org.apache.maven.reporting:maven-reporting-api:jar:2.0.6, commons-cli:commons-cli:jar:1.0, org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4,
org.apache.maven.shared:maven-filtering:jar:1.0, org.codehaus.plexus:plexus-interpolation:jar:1.12, org.sonatype.plexus:plexus-build-api:jar:0.0.4: Failure to
transfer org.apache.maven.reporting:maven-reporting-api:jar:2.0.6 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will
not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact
org.apache.maven.reporting:maven-reporting-api:jar:2.0.6 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000
(org.apache.maven.plugins:maven-resources-plugin:2.5:testResources:default-testResources:process-test-resources)
- Failure to transfer org.apache.maven.surefire:surefire:pom:2.10 from http://repo.maven.apache.org/maven2 was cached in the local repository,
resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact
org.apache.maven.surefire:surefire:pom:2.10 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000

参考技术A Multiple annotations found at this line:

有一行写重复了吧

eclipse创建Maven项目时pom.xml报错

报错的主要原因是:我们刚创建的项目下webapp里面没有INF-WEB/web.xml文件

技术图片

技术图片

 

 

 

 

解决办法:

右键项目->双击Properties打开Properties for **窗口,然后点击Maven->Project Facets

技术图片

找到如下图的选项,把取消选中

技术图片

点击右下方的 Apply,然后选中上面的 Dynamic Web Module 下方就会出现如图所示:

技术图片

点击上图所示,进入如下图所示:

技术图片

在Generate  web.xml前面打勾 ,并把Content directory修改为src/main/webapp

技术图片

然后一直ok ,Apply就可以啦。

 

以上是关于创建maven项目后pom.xml报错的主要内容,如果未能解决你的问题,请参考以下文章

刚创建的maven项目,pom.xml的第一行就报错

maven项目报错 pom

刚创建的maven项目,pom.xml的第一行就报错

新建maven项目出错 pom.xml报错

新建maven项目pom.xml文件报错

eclipse创建Maven项目时pom.xml报错