wesker0918
2015-07-15 08:42
采纳率: 50%
浏览 11.4k
已采纳

eclipse创建maven工程时报错

使用的是官方的Eclipse中自带的m2e插件,创建maven项目时就弹出个错误
图片说明
在pom.xml文件那会显示个红X,提示如下:
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (execution: default-testCompile, phase: test-
compile)
- Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6
or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-plugin-api:jar:2.0.6, org.apache.maven:maven-
project:jar:2.0.6, org.apache.maven:maven-profile:jar:2.0.6, org.apache.maven:maven-artifact-manager:jar:2.0.6, org.apache.maven:maven-plugin-registry:jar:2.0.6,
org.apache.maven:maven-core:jar:2.0.6, org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6, org.apache.maven:maven-repository-metadata:jar:2.0.6,
org.apache.maven:maven-error-diagnostics:jar:2.0.6, org.apache.maven:maven-plugin-descriptor:jar:2.0.6, org.apache.maven:maven-artifact:jar:2.0.6, org.apache.maven:maven-
settings:jar:2.0.6, org.apache.maven:maven-model:jar:2.0.6, org.apache.maven:maven-monitor:jar:2.0.6, org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:
Failure to transfer org.apache.maven:maven-plugin-api:jar:2.0.6 from https://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:maven-plugin-api:jar:2.0.6 from/to central
(https://repo.maven.apache.org/maven2): The operation was cancelled. (org.apache.maven.plugins:maven-resources-plugin:2.6:resources:default-resources:process-resources)
org.apache.maven.plugin.PluginExecutionException: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources failed: Plugin
org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-
plugin-api:jar:2.0.6, org.apache.maven:maven-project:jar:2.0.6, org.apache.maven:maven-profile:jar:2.0.6, org.apache.maven:maven-artifact-manager:jar:2.0.6,
org.apache.maven:maven-plugin-registry:jar:2.0.6, org.apache.maven:maven-core:jar:2.0.6, org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6,
org.apache.maven:maven-repository-metadata:jar:2.0.6, org.apache.maven:maven-error-diagnostics:jar:2.0.6, org.apache.maven:maven-plugin-descriptor:jar:2.0.6,
org.apache.maven:maven-artifact:jar:2.0.6, org.apache.maven:maven-settings:jar:2.0.6, org.apache.maven:maven-model:jar:2.0.6, org.apache.maven:maven-monitor:jar:2.0.6,
org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1: Failure to transfer org.apache.maven:maven-plugin-api:jar:2.0.6 from https://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:maven-plugin-api:jar:2.0.6 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled. at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) at
org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331) at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362) at
org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at
org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360) at
org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52) at
org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137) at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172) at
org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1) at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:
115) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod
$1.call(MavenBuilder.java:105) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99) at org.eclipse.m2e.core.internal.builder.MavenBuilder
$BuildMethod.execute(MavenBuilder.java:86) at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200) at org.eclipse.core.internal.events.BuildManager
$2.run(BuildManager.java:734) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:300) at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303) at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:359) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:382) at
org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235) at
org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by: org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-resources-
plugin:2.6 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-plugin-api:jar:2.0.6, org.apache.maven:maven-
project:jar:2.0.6, org.apache.maven:maven-profile:jar:2.0.6,

请问如何解决?谢谢

本机安装的maven是3.2.2
eclipse是4.5

m2e是1.2

最后也不知道什么原因,重新下了eclipse就没有问题了

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

6条回答 默认 最新

  • Evankaka 2015-07-15 09:22
    已采纳

    有可能是maven的版本太高了。eclipse哪个版本的。maven哪个版本的

    点赞 评论
  • DreamTHT 2015-07-15 10:54

    试下使用maven 更新下工程呢?

    点赞 评论
  • wesker0918 2015-07-20 01:44

    本机安装的maven是3.2.2
    eclipse是4.5
    m2e是1.2

    点赞 评论
  • 程序不是代码 2017-08-01 06:08

    我的也是这个错,eclipse4.6和4.7的都试过一样的,maven本机是3.2.2的不行,导入项目就没什么问题,就是新建的时候会出问题

    点赞 评论
  • lunajiao 2018-02-26 09:13

    eclipse里面maven配置不对,修改好配置再检查一下项目中tomcat有没有配置上就好了

    点赞 评论
  • lunajiao 2018-02-26 09:27

    图片说明
    上面红框里的必须填上,不然每次新建项目都要单独配置maven的设置文件,不设置就会报这个错,这里这设置完后项目如果还报红色叉号就检查一下tomcat配置上了吗?

    点赞 评论

相关推荐 更多相似问题