尝试导入Maven项目,但在导入后Eclipse中缺少某些依赖。

huangapple go评论84阅读模式
英文:

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

问题

我已经尝试了所有的方法,但对我都没有起作用。
在Eclipse中缺少一些Maven依赖,但在pom.xml文件和本地仓库中是存在的。
非常感谢任何帮助。

错误截图

英文:

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

Error Photo

答案1

得分: 1

理想情况下,当您运行Maven构建时,Maven会自动将所有依赖的JAR包下载到本地仓库,但我之前遇到过类似的问题,更新Maven项目对我起了作用 项目>maven>更新项目

下面我用截图解释了从构建到更新的整个过程,希望能对您有所帮助:

  1. 右键单击项目>运行为>Maven构建尝试导入Maven项目,但在导入后Eclipse中缺少某些依赖。
  2. 上述步骤应该启动编辑配置和启动窗口,在这里设置目标:clean install尝试导入Maven项目,但在导入后Eclipse中缺少某些依赖。
  3. 然后点击运行
  4. 再次右键单击项目>Maven>更新项目尝试导入Maven项目,但在导入后Eclipse中缺少某些依赖。
  5. 勾选强制更新快照/发布,并点击确定尝试导入Maven项目,但在导入后Eclipse中缺少某些依赖。
  6. 最后,再次检查Maven依赖项,查看是否已下载JAR包

附注:如果您在本地下载了JAR包,您可以手动将它们添加到构建路径中,右键单击项目>属性以解决此问题尝试导入Maven项目,但在导入后Eclipse中缺少某些依赖。

英文:

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

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项目,但在导入后Eclipse中缺少某些依赖。
  2. above step should launch edit configuration and launch window, here set Goals: clean install尝试导入Maven项目,但在导入后Eclipse中缺少某些依赖。
  3. then click run
  4. again right click on project>Maven>update project尝试导入Maven项目,但在导入后Eclipse中缺少某些依赖。
  5. check force update of snapshot/releases and click ok尝试导入Maven项目,但在导入后Eclipse中缺少某些依赖。
  6. finally, check under maven dependencies again if jars have downloaded

P.S. if you have JARs downloaded locally you can add them manually to your build path right click project>properties to resolve the issue 尝试导入Maven项目,但在导入后Eclipse中缺少某些依赖。

答案2

得分: 0

假设您正确导入了项目,问题可能是您没有定义包含您想要使用的依赖项的存储库。

有关如何定义存储库的更多信息,请参阅https://maven.apache.org/guides/introduction/introduction-to-repositories.html。

英文:

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.

huangapple
  • 本文由 发表于 2020年9月29日 23:10:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/64122491.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定