eclipse m2eclipse 不会下载任何依赖项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10825182/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 18:17:08  来源:igfitidea点击:

m2eclipse will not download any dependencies

javaeclipsemavendependencies

提问by Telax

I was hoping someone might be able to help.

我希望有人能够提供帮助。

On a brand new windows machine. I've downloaded and installed java jdk before downloading and running the latest version of eclipse (indigo).

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

From there I have installed the maven integration plugin from the marketplace and created a new maven projected.

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

The project has a ton of errors mainly to do with missing dependencies or life cycle management.

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

When I do maven-clean I get the following error message:

当我执行 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]

I am not behind a firewall and I do not use a proxy. My maven settings.xml is completely default as is my maven project. No classes added, nothing added to the pom.

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

Can anyone help?

任何人都可以帮忙吗?

All the best.

祝一切顺利。

p.s here are the errors shown in the pom:

ps 这里是 pom 中显示的错误:

1:

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:

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:

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:

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

回答by khmarbaise

Furthermore i recommend to test the configuration etc. first with command line client of Maven (Maven 3.0.X) and not within Eclipse.

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

The 1./4. shows that you have tried to download some artifact which has failed for whatever reasons. The simple solution for that is to delete the local repository and retry the build. But i recommend to do that first on command line to check if everything is fine.

1./4。表明您已尝试下载一些由于某种原因而失败的工件。对此的简单解决方案是删除本地存储库并重试构建。但我建议先在命令行上执行此操作,以检查是否一切正常。

The 2./3. are indications that the project you are trying to compile does not contain a correct plugin coverage for m2e which can be read in the docshow to solve that.

2./3。表明您尝试编译的项目不包含正确的m2e插件覆盖范围,可以在文档中阅读如何解决该问题。

回答by Lukasz

Problem:
You are missing an artefact in Your maven repository.

How to verify:
If You will browse Your repository You will find out that under .m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.4.1/ artefact will have lastUpdated suffix - maven attempted to download this artefact but failed.

How to solve:
Just add an appropriate artefact into Your maven repository:) There are several ways how to do that but the simplest one will be dropping the folder with the missing artefact. Add since You can build Your project from the CMD just add missing artefact as a dependency into Your project. Build the project from the CMD.

问题:
您的 Maven 存储库中缺少人工制品。

如何验证:
如果您浏览您的存储库,您会发现在 .m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.4.1/ artefact 下会有 lastUpdated 后缀 - maven 试图下载这个人工制品但失败了。

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

回答by Neel

Add dependency is not working through eclipse IDE(JUNO 4.2). Fixed the issue by manually adding dependencies with the below command on command prompt

添加依赖项无法通过 Eclipse IDE(JUNO 4.2)工作。通过在命令提示符下使用以下命令手动添加依赖项来修复该问题

  1. go to the location where your pom.xml is located
  2. mvn install
  3. once you see status BUILD success from now onwards we can proceed with IDE.
  1. 转到你的 pom.xml 所在的位置
  2. 安装
  3. 从现在开始,一旦您看到状态 BUILD 成功,我们就可以继续使用 IDE。

回答by Azhar_k

Clearly this is an issue of proxy. Either use VPN or edit procy setting in setting.xml. I searched lot about this error. Finally, I used VPN(Virtual private network ) to disable the proxy and was able to use cetral repository of Maven.

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

IF you dont want to USE VPN just change Settings.xml host address with proxy address of ur company(which is available in IE->tools->connection->LAN settings->advanced->http. )

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

回答by Jileni Bouguima

This is a proxy problem:

这是一个代理问题:

  1. add your proxy config in your setting.xml
  2. remove .m2 folder from your home directory
  3. run any maven command in interactive mode from command line, for example try to create a project mvn archetype: generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=com.mycompany.app -DartifactId=my-webapp
  4. that's all
  1. 在 setting.xml 中添加您的代理配置
  2. 从您的主目录中删除 .m2 文件夹
  3. 从命令行以交互模式运行任何 maven 命令,例如尝试创建一个项目 mvn 原型: generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=com.mycompany.app -DartifactId=my-webapp
  4. 就这样

回答by schoenk

I had the same problem. It was because I configured the repository in the settings.xmlof my Maven Installation. But this in not used by Eclipse as it comes with its own Maven implementation. You need to configure the repositories (mirror section) in the settings.xml in your profile (.m2/settings.xml).

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