首页 \ 问答 \ 真正的Maven依赖是什么?(What really are Maven dependencies?)

真正的Maven依赖是什么?(What really are Maven dependencies?)

我尝试搜索谷歌和论坛,但我无法得到一个确切的,最重要的简单答案。 我还是初学者,但是我必须在Eclipse中做一个关于Maven和依赖项的项目,以及如何部署它们。 我的问题是什么是依赖项,如何知道我必须包含哪些依赖项? 我希望这个问题听起来不那么愚蠢,但我有点困惑,因为可能每个项目都需要不同的依赖关系,但我们究竟如何选择我们需要哪些? 非常感谢!


I tried searching google and the forum but I couldn't get to an exact and foremost simple answer. I am still a beginner but I have to do a project in Eclipse about Maven and dependencies and how do I deploy them. My question is really what are dependencies and how do I know what dependencies I have to include for a certain project? I hope the question doesn't sound that stupid but I am a bit confused as to probably every project needs different dependencies but how exactly do we pick which ones do we need? Thanks a lot!


原文:https://stackoverflow.com/questions/27110095
更新时间:2019-12-07 11:47

最满意答案

Maven依赖项是不同的工件,工件可以是任何类型,例如jar,war,ear,xml或任何其他格式。 一般来说,依赖项是项目所需的库,在开发项目时,您/开发人员应该知道他正在使用哪个库,例如,如果您在Spring Core上构建某些东西,并且您的项目需要Spring Core jar文件,那么您可以说Spring Core是您项目的依赖项。

公共或开源依赖项已经托管在maven中央存储库上,当您在pom文件中提供所需依赖项的正确坐标时,maven将从指定的存储库中获取该依赖项。

依赖关系具有不同的范围,例如编译,测试等,这意味着您需要该依赖关系,例如,如果依赖关系的范围是测试,那么它意味着您只需要它来执行单元测试。

我希望这已经回答了你的问题。 为了进一步了解,您可以阅读有关Maven的任何好书。


Maven dependencies are different artifacts and artifact could be of any type, for example jar, war, ear, xml or any other format. Generally speaking Dependencies are the libraries which are required by your project and while developing your project you/developer should know which library he is using, For example if you are building something on Spring Core and your project require Spring Core jar file then you can say that Spring Core is dependency of your project.

Common or Open Source dependencies are already hosted on maven central repository and when you give the correct coordinates of that required dependency in your pom file, maven fetches that dependency for you from the specified repository.

Dependencies have different scopes, for example compile, test etc, it mean that for what purpose you need that dependency for example if a dependency's scope is test then it means you only require it for executing the unit tests.

I hope this has answered your question. For further understand you may read any good book on Maven.

2014-11-24

相关文章

更多

最新问答

更多
  • 删除不适用于JSP中使用for循环的每个id(Deletion not working for every id using for loop in JSP)
  • 如何从std :: filesystem :: path中删除引号(How to remove quotation marks from std::filesystem::path)
  • 验证多个控制器方法的URL路径(Validate URL path for several controller methods)
  • 如何在datarow []中的列中找到最大值?(How to find max value in a column in a datarow[] ?)
  • 如何使用预定义文本替换来自数据库的部分结果(How do I replace part of result coming from Database with predefined text)
  • Selenium Java注入了新的Javascript函数(Selenium Java inject new Javascript function)
  • 使用.on的多个下拉菜单选择文本仅适用于第一个下拉列表(Multiple Dropdowns Menu Selection text using .on works only on first dropdown)
  • 快速将黄土曲线添加到大型数据集图中的方法(Quick way to add loess curve to large data set graph)
  • FilteringSelect in mvc(FilteringSelect in mvc)
  • 在Delphi XE2中开发Mac或iOS应用程序需要哪些硬件/软件?(What hardware/software is necessary to develop Mac or iOS apps in Delphi XE2?)
  • 在原型的构造函数中初始化属性时获取“未定义”(Getting 'undefined' when a property is initialized in the constructor of a prototype)
  • 通过越狱加载的应用程序的Documents文件夹位置(Location of Documents folder for an app loaded via jailbreak)
  • 在OpenGL中使用可编程和固定管道功能(Using both programmable and fixed pipeline functionality in OpenGL)
  • 将任何用户输入重定向到单独的底层程序(redirect any user input to a separate underlying program)
  • 编辑文本不能正常工作android(Edit texts not working properly android)
  • “user_denied”Facebook应用页面上的Facebook用户区域设置(Facebook user locale on “user_denied” facebook app page)
  • 在大图像中找到小的部分透明图像的坐标(find coordinates of small partially-transparent image within a large image)
  • 我如何在cakephp 3.1中获得完整的相对路径?(How i can get full relative path of image in cakephp 3.1?)
  • 如何保存拖动标记的新本地化?(How to save new localization of dragged marker?)
  • MySQL UPDATE vs INSERT和DELETE(MySQL UPDATE vs INSERT and DELETE)
  • 在执行查询之前,在SQLAlchemy模型中将datetime转换为unix时间戳?(Convert datetime to unix timestamp in SQLAlchemy model before executing query?)
  • OpenCL与OpenGL互操作的优势(Advantage of OpenCL interoperability with OpenGL)
  • 如何解析用点和等分隔的数据然后添加到listview(How to parsing data from delimited with dot and equal then add to listview)
  • 带调试输出的X3解析器段错误(BOOST_SPIRIT_X3_DEBUG)(X3 parser segfaults with debug output (BOOST_SPIRIT_X3_DEBUG))
  • 将文件夹名称添加到fgrep结果(Add folder name to fgrep result)
  • 在MySQL中加载一个表是非常慢的(Loading one table in MySQL is ridiculously slow)
  • 如何将JSON放入PHP变量?(How do I put JSON into a PHP Variable?)
  • 如何绕过Microsoft.Speech.Recognition中的不流畅?(How to bypass disfluencies in Microsoft.Speech.Recognition?)
  • 原点的最后一行是什么?(What is the last row of an origin for?)
  • 将字符串转换为javascript中的操作(Translate String to operation in javascript)