首页 \ 问答 \ 真正的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!

更新时间:2019-12-07 11:47


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



我希望这已经回答了你的问题。 为了进一步了解,您可以阅读有关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.




退出线程时如何执行代码(How can I execute code when exiting a thread)

您可以将代码包装在您自己的代码中的单独线程中,该代码具有try / finally块,并从try调用“real” Runnable的run方法,如下所示: final Runnable realRunnable = ... // This is the actual logic of your thread (new Thread(new Runnable() { public void run() { try { realRunnable.run

在主模板的编辑器中如何使solr搜索对象?(How to make object of solr search in editor of main template?)

您需要使用基本的Solr TypoScript。 You need to use the basic Solr TypoScript.

为什么我的C#-console应用程序在复制文件时因“内存不足”而异常?(Why does my C#-console application crash due to a 'Out of Memory'-exception when copying files?)

正如其他答案中所述,您可以使用using语句以正确的方式调用对象上的Dispose方法。 using (Image Billede = Bitmap.FromFile(file)){ ... } 但是,对于您的代码,您可能需要检查图像格式,因为如果(来自MSDN) Image.FromFile函数将引发OutOfMemoryException : 该文件没有有效的图像格式。 -要么- GDI +不支持文件的像素格式。 看看这个 As noted in other answers,

使用命名参数作为变量(Using named arguments as variables)

从我能做出来的事情你可以构造出密钥,然后传递一个arg来构造字典,然后将其包含在过滤器中 key = '%s_%s' % (kwargs['m0'], kwargs['m1']) result = Artists.objects.filter(**{key: arg}) From what I can make out you can construct the key and then pass in an arg to construct the dict, then include th

分段错误:C ++使用lambda比较器对字符串向量进行排序(Segmentation Fault: C++ sort an string vector with lambda comparator)

您的比较功能不是有效的。 它在无反射性( comp(x,x)永远不会是真 )和不对称( 如果comp(x,y)为真,然后comp(y,x)必须为假 )两者都失败,两者都是严格弱排序哪些std::sort需要它的比较器。 operator<或operator>满足此要求。 但是operator<=和operator>=不。 如果您将比较函数更改为: auto comp = [](const string& first, const string& second)->bool { retur

微软答案引擎(Microsoft Answers Engine)

这是一个自定义的,专有的,内部应用程序。 它在Codeplex上不可用。 [引用需要] 这是我能够 在这件事上找到的 所有 事情 。 It's a custom, propietary, inhouse application. It's not available on Codeplex. [citation needed] This is all I could find on the matter.

用DataTrigger绑定到Style中的Self(Binding to Self in Style with DataTrigger)

你为什么不把它改为触发器? <Style x:Key="MyButtonStyle" TargetType="Button"> <Style.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Background"

awk shebang不起作用(awk shebang doesn't work)

要将文件作为脚本运行,您必须键入: ./<script> 编辑 : 正如William Pursell指出的那样. 不是source的别名,但恰恰相反。 。 不是源的别名。 。 是用于在当前shell中运行另一个脚本的sh标准命令。 source是一个源自csh的命令,被许多sh克隆用作别名。如果源被视为除了憎恶之外的任何东西,它是。的别名,而不是相反。 To run a file as a script you must type: ./<script> Edit: As pointed




  • asp.net任意用户信息(asp.net arbitrary user info)
  • 如何使用python计算docx文件中表中行的值(How to count the row's values in tables in docx file by using python)
  • MySQL:用户访问和数据库覆盖(MySQL: User access and DB overwriting)
  • 还有另一种“使用未分配的局部变量”的问题(Yet Another “Use of unassigned local variable 'whatever' ” question)
  • 开源证书颁发机构软件(Open source certificate authority software)
  • Rails中的迭代form_for是在create上添加模型的所有实例(Iteration in Rails form_for is adding all instances of model on create)
  • 如何扩展我的表视图单元格?(How to expand my table view cell?)
  • 如何使用SPARQL区分Thing和无生命对象(How to differentiate between a Thing and an inanimate object with SPARQL)
  • 在IdentityServer中,Client Secrets和Scope Secrets有什么区别?(In IdentityServer, what is the difference between Client Secrets and Scope Secrets?)
  • 如何在具有附加类时重写类(How do I override a class when it has a attached class)
  • 如何使用Git在Azure上部署C#,MVC4应用程序(How to deploy a C#, MVC4 application on Azure using Git)
  • Sitecore 7内容搜索爬网程序根目录之外的索引项(Sitecore 7 Content Search indexing items outside of crawler root)
  • 我应该在线课程使用utf-8编码吗?(Should I use utf-8 encoding for an online course?)
  • 如何在Cucumber-JS步骤定义中使用Node-mysql连接到MySQL?(How to connect to MySQL using Node-mysql in a Cucumber-JS step definition?)
  • 在MVC 4中的google.maps.LatLng(lat,lon)中将JSON字符串值分配给纬度和经度(Assign the JSON string value to Latitude and Longitude in google.maps.LatLng(lat,lon) in MVC 4)
  • awk:通过特定的分隔符删除字符串(awk: remove strings by specific delimiter)
  • 如何测试Vista的应用程序(How to test app for Vista)
  • Elasticsearch聚合器 - 缺失值的工作原理(Elasticsearch aggregators - How missing values work)
  • 绘制datetime.date熊猫(Plot datetime.date pandas)
  • PostgreSQL作为WSO2 EI和APIM + IS的数据源(PostgreSQL as datasource for WSO2 EI and APIM+IS)
  • 如何使用bash在postgres中运行alter table脚本(How to run alter table script in postgres using bash)
  • 可能使用PHP阻止整个美国州访问我的网站?(Might it be possible to block an entire US state from accessing my site, using PHP?)
  • restangular删除并输入错误网:: ERR_NAME_NOT_RESOLVED(restangular remove and put error net::ERR_NAME_NOT_RESOLVED)
  • 常见问题解答的Modx(Revolution)搜索功能(Modx(Revolution) search function for FAQs)
  • Rubymine如何使用远程口译员和Git?(How Does Rubymine Work With Remote Interpreters and Git?)
  • prepareForSegue和PerformSegueWithIdentifier发件人(prepareForSegue and PerformSegueWithIdentifier sender)
  • postgrsql与PowerShell无提示安装问题(postgresql silent installation issue with powershell)
  • 比较两个greps的输出(Comparing output from two greps)
  • 使用.NET RIA Data Services删除Silverlight 3中的数据(Deleting data in Silverlight 3 with .NET RIA Data Services)
  • 此行中AND运算符的含义(meaning of the AND operator in this line)