首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >m2eclipse错误

m2eclipse错误
EN

Stack Overflow用户
提问于 2012-01-12 20:05:48
回答 17查看 187.9K关注 0票数 69

我正在使用Eclipse开发一个web应用程序,并使用maven原型生成项目。

当我启用maven依赖项管理时,Eclipse在pom文件中标记了一些错误,这个错误是:

代码语言:javascript
复制
 Multiple annotations found at this line:
- Execution default-testResources of goal org.apache.maven.plugins:maven-resources-          plugin:2.4.3:testResources failed: 
 Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to collect 
 dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 () (org.apache.maven.plugins:maven-resources-
 plugin:2.4.3:testResources:default-testResources:process-test-resources)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile 
 (execution: default-compile, phase: compile)
- CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: 
 PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be 
 resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 (): 
 ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6: 
 ArtifactResolutionException: Failure to transfer org.apache.maven:maven-plugin-api:pom:2.0.6 from http://repo1.maven.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:pom:2.0.6 from/to central (http://
 repo1.maven.org/maven2): null to http://repo1.maven.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-
 api-2.0.6.pom
- CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: 
 PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be 
 resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 (): 
 ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6: 
 ArtifactResolutionException: Failure to transfer org.apache.maven:maven-plugin-api:pom:2.0.6 from http://repo1.maven.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:pom:2.0.6 from/to central (http://
 repo1.maven.org/maven2): null to http://repo1.maven.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-
 api-2.0.6.pom
- Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources failed: Plugin 
 org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to collect 
 dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 () (org.apache.maven.plugins:maven-resources-
 plugin:2.4.3:resources:default-resources:process-resources)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:
 2.3.2:testCompile (execution: default-testCompile, phase: test-compile)

我的pom文件如下:

代码语言:javascript
复制
<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/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.lala.sarasa</groupId>
   <artifactId>msrdecision</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>msrdecision Maven Webapp</name>
  <url>http://maven.apache.org</url>
 <dependencies>
   <dependency>
     <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>hello</finalName>
   </build>
 </project>

有什么想法吗?

EN

回答 17

Stack Overflow用户

回答已采纳

发布于 2012-07-04 20:12:34

在这种特殊的情况下,解决方案是eclipse (Window -> Preferences ->网络连接)的正确代理配置,该公司拥有严格的安全系统。我将离开这个问题,因为有一些答案可以帮助社区。非常感谢你上面的回答。

票数 10
EN

Stack Overflow用户

发布于 2012-03-08 20:52:59

我在Eclipse 3.7.2 (Indigo)和maven 3.0.4上也遇到了同样的问题。

在我的例子中,问题是由于{user.home}\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.4.3文件夹中缺少maven-resources-plugin-2.4.3.jar而导致的。(不知道为什么maven没有更新它)

解决方案:

1.)向pom.xml添加依赖项

代码语言:javascript
复制
<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.4.3</version>
</dependency>

2.)从Eclipse或命令行运行mvn install

3.)在eclipse中刷新项目(F5)

4.)在项目上运行Maven > Update Project Configuration... (右键单击)

JAR文件下载到本地存储库,WS中没有错误。

票数 74
EN

Stack Overflow用户

发布于 2012-09-01 00:22:58

我在Eclipse 3.7.2 (Indigo)和maven 3.0.4上也遇到了同样的问题。

Eclipse没有获取我的maven设置,所以我这样做是为了解决这个问题:

  1. Window -首选项-

- Installations

代码语言:javascript
复制
- Add  (Maven 3.0.4 instead of using Embedded)
- Click Apply & OK

  1. Maven >更新项目配置...在项目上(从命令click)
  2. Shutdown Eclipse
  3. Run line.
  4. Open mvn install

中右键打开Eclipse

这些步骤对我有效,但问题并不一致。我只在一台电脑上遇到过问题。

票数 35
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8834806

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档