问题描述
它们有何不同?还是一样?
How are they different? Or are they the same?
推荐答案
存储库是工件(例如jars)的集合.您可以将其视为各种工件的存储/缓存.
Repository is a collection of artifacts (eg: jars). You can think of it as a mere storage / cache of various artifacts.
依赖性是您的项目依赖于另一个工件来执行其任务(例如:编译,运行,单元测试)的情况
Dependency is a situation where your project dependent on another artifact to perform its task (eg: compile, run, unit test)
在Maven项目中,通常会在pom的<dependency>
部分中声明所需的工件,还可以声明maven应该在<repositories>
部分中查找依赖项的存储库.
On a maven project you typically declare what artifacts you need on the <dependency>
section of your pom, and you can also declare what repositories maven should lookup the dependency from at the <repositories>
section.
默认情况下,maven将在中央存储库上查找工件.但是,对于组织来说,通常有一个内部存储库,其中包含内部开发的工件.因此,通常会在pom的<repositories>
部分配置此内容.
By default maven will lookup the artifacts on the central repository. But it's common for an organization to have an internal repository containing in-house developed artifacts. Hence typically <repositories>
section on the pom is configured with this.
http://maven.apache.org/guides/index.html
这篇关于Maven中的存储库和依赖项之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!