McS*_*Sas 69 eclipse m2eclipse maven
我正在使用Eclipse开发Web应用程序,并使用maven原型生成项目.
当我启用maven依赖管理时,Eclipse会在pom文件中标记一些错误,这个错误是:
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)
Run Code Online (Sandbox Code Playgroud)
我的pom文件如下:
<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>
Run Code Online (Sandbox Code Playgroud)
任何的想法?
Bet*_*sta 74
Eclipse 3.7.2(Indigo)和maven 3.0.4也遇到了同样的问题.
对我来说,这个问题是由缺少造成maven-resources-plugin-2.4.3.jar
的{user.home}\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.4.3
文件夹中.(不知道为什么maven没有更新它)
解:
1.)为pom.xml添加依赖项
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
2.)mvn install
从Eclipse或命令行运行
3.)在eclipse中刷新项目(F5)
4.)Maven > Update Project Configuration...
在项目上运行(右键单击)
JAR文件下载到本地存储库,WS中没有错误.
Kyg*_*ght 35
Eclipse 3.7.2(Indigo)和maven 3.0.4也遇到了同样的问题.
Eclipse没有拿起我的maven设置,所以这就是我解决问题的方法:
窗口 - 首选项 - Maven - 安装
项目中的 Maven> 更新项目配置 ...(右键单击)
关闭 Eclipse
运行 mvn install
命令行.
打开 Eclipse
这些步骤对我有用,但问题并不一致.我只在一台电脑上遇到问题.
小智 29
只需转到您的用户文件夹,其中有一个".m2"文件夹,打开它并删除文件夹"repository".转到eclipse,清理你的项目,然后右击 - > Maven-> Update Project ..你准备好了.
McS*_*Sas 10
在这种特殊情况下,解决方案是eclipse的正确代理配置(Window - > Preferences - > Network Connection),该公司拥有严格的安全系统.我会留下这个问题,因为有些答案可以帮助社区.非常感谢您的上述答案.
归档时间: |
|
查看次数: |
182992 次 |
最近记录: |