Eclipse项目中缺少Maven依赖项 [英] Missing Maven dependencies in Eclipse project

查看:275
本文介绍了Eclipse项目中缺少Maven依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个与maven建立的项目来解决依赖问题。它通常工作正常,但现在我正在编译并运行它在一个新的电脑上,我有缺陷的依赖关系的问题在Eclipse。



有趣的是,如果我在控制台或eclipse中运行mvn package,它工作正常,甚至产生包含所有必需的jar的战争。只有Eclipse抱怨由于构建路径不完整而未建成项目,因为找不到org.slf4j.Logger ...的类文件。如果我将项目与其他计算机(项目工作正常)进行比较,我注意到在Eclipse中的Maven依赖项列表中缺少相当多的库。事实上,他们在打包的战争中,他们也可以在存储库文件夹下找到。



所以,jar就在那里只有Eclipse不会将它们全部列在 Maven依赖关系。我可以做什么?



计算机在Windows 7上运行,64位java& eclipse。

解决方案

解决问题



我不知道但是我在Eclipse中做了4件事:




  • 窗口 - >首选项:Maven->安装:全局设置 - >打开文件和硬编码的localRepository

  • Project-> Clean

  • 右键单击项目:Maven->更新依赖项

  • 右键单击项目:Maven->更新项目配置



我猜这是Update依赖关系,因为在前两个没有更改。


We have a project set up with maven for resolving dependancies. It usually works fine, but now I am trying to compile and run it on a new PC and I have problem with missing dependencies in Eclipse.

What is funny is that if I run "mvn package" in console or in eclipse, it works fine and even produces war containing all necessary jars. Only Eclipse complains with "The project was not built since its build path is incomplete. Cannot find the class file for org.slf4j.Logger...". If I compare the project with some other computer (where project works fine), I notice that there are quite a few libraries missing under "Maven dependencies" listing in Eclipse. Eventhough they are in the packaged war and they can be found also under repository folder.

So, the jar-s are there just Eclipse won't list them all under "Maven dependencies". What can I do?

Computer is running on Windows 7 with 64bit java & eclipse.

解决方案

Problem solved!

I don't know what exactly solved it, but I did 4 things in Eclipse:

  • Window->Preferences: Maven->Installations: Global settings -> open file and hardcoded localRepository
  • Project->Clean
  • right click on project: Maven->Update dependencies
  • right click on project: Maven->Update project configuration

I guess it was the Update dependencies since right after first two there were no change.

这篇关于Eclipse项目中缺少Maven依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆