简体   繁体   English

尝试导入 maven 项目,但导入后 eclipse 中缺少一些依赖项

[英]Trying to import maven project but some dependencies are missing in eclipse after the import

I have tried everything but nothing worked for me.我已经尝试了一切,但没有任何效果对我有用。 Some of maven dependencies are missing in the eclipse but are present in the pom.xml file and local repository Any help would be much appreciated eclipse 中缺少一些 maven 依赖项,但存在于 pom.xml 文件和本地存储库中任何帮助将不胜感激

Error Photo错误照片

Assuming you correctly imported the project, the problem could be that you don't have the repositories defined that contain the dependencies you want to use.假设您正确导入了项目,问题可能是您没有定义包含要使用的依赖项的存储库。

See https://maven.apache.org/guides/introduction/introduction-to-repositories.html for more information on how to define your repositories.有关如何定义存储库的更多信息,请参阅https://maven.apache.org/guides/introduction/introduction-to-repositories.html

Ideally When you run a Maven build, then Maven automatically downloads all the dependency jars into the local repository but I ran into the similar problem before and updating the maven project did the trick for me project>maven>update project理想情况下,当您运行 Maven 构建时,Maven 会自动将所有依赖项 jar 下载到本地存储库中,但我之前遇到了类似的问题,并且更新 Maven 项目对我来说是一个窍门project>maven>update project

below I have explained whole thing from build to updating with screen shots hoping it helps you下面我用屏幕截图解释了从构建到更新的整个过程,希望对您有所帮助

  1. right click project> run as> maven build右键单击项目> 运行方式> Maven 构建在此处输入图片说明
  2. above step should launch edit configuration and launch window, here set Goals: clean install上面的步骤应该启动编辑配置和启动窗口,这里设置目标:全新安装在此处输入图片说明
  3. then click run然后点击运行
  4. again right click on project>Maven>update project再次右键单击项目>Maven>更新项目在此处输入图片说明
  5. check force update of snapshot/releases and click ok检查快照/发布的强制更新并单击确定在此处输入图片说明
  6. finally, check under maven dependencies again if jars have downloaded最后,如果 jars 已经下载,再次检查 Maven 依赖项

PS if you have JARs downloaded locally you can add them manually to your build path right click project>properties to resolve the issue PS如果您在本地下载了JAR,您可以将它们手动添加到您的构建路径中右键单击项目>属性以解决问题在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM