eclipse 未能在Maven项目中收集依赖项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18702109/
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
Failed to collect dependencies in Maven project
提问by Flame_Phoenix
When I try to build or compile my Maven project I get the following error message:
当我尝试构建或编译我的 Maven 项目时,我收到以下错误消息:
[ERROR] Failed to execute goal on project dss-services: Could not resolve dependencies for project net.jnd.thesis:dss-services:jar:0.0.1-SNAPSHOT: Failed to collect dependencies for [log4j:log4j:jar:1.2.16 (compile), org.slf4j:slf4j-api:jar:1.6.4 (compile), org.slf4j:jcl-over-slf4j:jar:1.6.4 (compile), org.slf4j:slf4j-log4j12:jar:1.6.4 (compile), net.sf.flexjson:flexjson:jar:2.1 (compile), commons-beanutils:commons-beanutils:jar:1.8.3 (compile), org.apache.commons:commons-lang3:jar:3.1 (compile), org.eclipse.jetty:jetty-websocket:jar:8.1.4.v20120524 (compile), net.jnd.thesis:dss-common:jar:0.0.1-SNAPSHOT (compile)]: Failed to read artifact descriptor for net.jnd.thesis:dss-common:jar:0.0.1-SNAPSHOT: Could not find artifact net.jnd.thesis:dss:pom:0.0.1-SNAPSHOT -> [Help 1]
During my research I found two possible solutions:
在我的研究中,我发现了两种可能的解决方案:
However, the answers provided do not apply because I already re-created the project from zero (and I do not see how changing the name of the directory will help) and because my error message differs from the error messages presented in those specific cases.
但是,提供的答案并不适用,因为我已经从零重新创建了项目(并且我看不到更改目录名称会有什么帮助),并且因为我的错误消息与在这些特定情况下显示的错误消息不同。
I think that my m2e plugin in Eclipse must have some sort of configurations issue and therefore it cannot download nor find the needed Maven artifacts, but I have no idea on how to solve the problem :S
我认为我在 Eclipse 中的 m2e 插件必须有某种配置问题,因此它无法下载或找到所需的 Maven 工件,但我不知道如何解决这个问题:S
采纳答案by Flame_Phoenix
After a lot of headaches and time I simply realized that there is a huge problem with the m2e plugin and its versions. Thus I solved my problem by making entering the project and making mvn clean compile
followed by mvn install
.
经过大量的头痛和时间,我只是意识到 m2e 插件及其版本存在巨大问题。因此,我通过进入项目并使其mvn clean compile
后跟mvn install
.
Thanks for the help anyway!
无论如何感谢您的帮助!
回答by ilopezluna
Could you try use only console ?
您可以尝试仅使用控制台吗?
"mvn clean compile" should be enough to check if problem is with eclipse or not.
“mvn clean compile”应该足以检查问题是否与eclipse有关。
Sometimes I had problem with dependencies in some maven project, and usually was because i didn't add a specific repository for them. Some dependencies are not installed in maven central repo, so you must check if your dependencies ara available in this repo. If not, you can add more repositories in your pom in order to tell maven "hey look for my dependencies in this other repo too".
有时我在某些 maven 项目中遇到依赖关系问题,通常是因为我没有为它们添加特定的存储库。某些依赖项未安装在 maven 中央仓库中,因此您必须检查您的依赖项 ara 在此仓库中是否可用。如果没有,您可以在 pom 中添加更多存储库,以便告诉 Maven “嘿,也在这个其他存储库中查找我的依赖项”。
回答by pkm
Looks like you are missing some Maven repos. Ask for your friend's .m2/settings.xml, and you'll probably want to update the POM to include the repositories there.
看起来您缺少一些 Maven 存储库。询问您朋友的 .m2/settings.xml,您可能希望更新 POM 以包含其中的存储库。