m2eclipse不会下载任何依赖项

时间:2012-05-30 22:30:14

标签: java eclipse maven dependencies

我希望有人可以提供帮助。

在一台全新的Windows机器上。在下载并运行最新版本的eclipse(indigo)之前,我已经下载并安装了java jdk。

从那里我已经从市场安装了maven集成插件并创建了一个新的maven投影。

该项目存在大量错误,主要与缺少依赖关系或生命周期管理有关。

当我进行maven-clean时,我收到以下错误消息:

[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo1.maven.org/maven2): Invalid argument: getsockname to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom -> [Help 1]

我不在防火墙后面,我不使用代理。我的maven settings.xml是完全默认的,就像我的maven项目一样。没有添加任何课程,没有任何内容添加到pom。

有人可以帮忙吗?

一切顺利。

p.s这里是pom中显示的错误:

1:

CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 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.plugins:maven-compiler-plugin:pom:2.3.2 from/to central (http://repo1.maven.org/maven2): Invalid argument: getsockname to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom

2:

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile)

3:

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile)

4:

Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 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.plugins:maven-resources-plugin:pom:2.4.3 from/to central (http://repo1.maven.org/maven2): Invalid argument: getsockname to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.4.3/maven-resources-plugin-2.4.3.pom

6 个答案:

答案 0 :(得分:1)

此外,我建议首先使用Maven(Maven 3.0.X)的命令行客户端测试配置等,而不是在Eclipse中。

1./4。表明你试图下载一些因任何原因失败的工件。简单的解决方案是删除本地存储库并重试构建。但我建议首先在命令行上检查一切是否正常。

2./3。表明您正在尝试编译的项目不包含m2e which can be read in the docs如何解决该问题的正确插件范围。

答案 1 :(得分:0)

问题:
  您在maven存储库中缺少一个人工制品
如何验证:
  如果您将浏览您的存储库您将发现在.m2 / repository / org / apache / maven / plugins / maven-clean-plugin / 2.4.1 / artefact下将具有lastUpdated后缀--maven尝试下载此工件但失败了。

如何解决:
  只需在你的maven存储库中添加一个合适的人工制品:)有几种方法可以做到这一点,但最简单的方法是删除带有缺失的人工制品的文件夹。添加,因为您可以从CMD构建您的项目,只需将缺少的人工制品作为依赖项添加到您的项目中。从CMD构建项目。

答案 2 :(得分:0)

通过eclipse IDE(JUNO 4.2)添加依赖项无效。通过在命令提示符下使用以下命令手动添加依赖项来修复此问题

  1. 转到pom.xml所在的位置
  2. mvn install
  3. 从现在开始看到状态BUILD成功后,我们可以继续使用IDE。

答案 3 :(得分:0)

显然这是一个代理问题。在settings.xml中使用VPN或编辑procy设置。我搜索了很多关于这个错误。最后,我使用VPN(虚拟专用网络)来禁用代理,并能够使用Maven的cetral存储库。

如果您不想使用VPN,只需更改具有您公司代理地址的Settings.xml主机地址(可在IE-> tools-> connection-> LAN settings-> advanced-> http中找到) 。)

答案 4 :(得分:0)

这是代理问题:

  1. 在您的setting.xml中添加您的代理配置
  2. 从您的主目录中删除.m2文件夹
  3. 从命令行以交互模式运行任何maven命令,例如尝试创建项目 mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=com.mycompany.app -DartifactId=my-webapp
  4. 那是

答案 5 :(得分:0)

我遇到了同样的问题。这是因为我在Maven安装的settings.xml中配置了存储库。但这并没有被Eclipse使用,因为它带有自己的Maven实现。您需要在配置文件(.m2/settings.xml)的settings.xml中配置存储库(镜像部分)。