依赖关系和存储库? [英] Dependencies and Repositories?
问题描述
我是Maven的新手,我之前看到了另一个问题,但我仍然感到困惑。
I am new to Maven and I previously saw another question regarding the similar thing but I am still confused.
依赖关系和存储库与库之间有何区别?
我知道依赖项包含可以引用该项目的库。但是,它与外部依赖关系又有什么关系呢?
What is the difference between dependencies and repository in relation to libraries?
I am aware that dependencies contain libraries that the project can be referred to. But how would it relate to external dependencies?
推荐答案
使用maven时会产生一连串的问题。每个存储库都包含一个由组/工件/版本(GAV)唯一标识的库代码存储。
When you use maven there is a chain of repostitories. Each repository containers a store of library code, uniquely identified by group/artifact/version (GAV).
1)顶层是 Maven Central 在互联网上。
1) At the top level is maven central on the internet.
2)在下一级别,他们通常
2) At the next level their is usally a corporate repository, Nexus or JFrog or similar.
3)在本地计算机上,它们是一个存储库,通常在您的主目录.m2 / repo
3) On your local machine their is a repository, usually under your home directory .m2/repo
当在pom中包含依赖项时:
When you include a dependency in a pom like :
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
然后进行Maven构建,它将首先从本地仓库中查找,然后进入您的公司,最后到了maven-central。每次运行时,它将依赖项下载到本地存储库中,以便下次使用。
and then do a maven build it will go up the tree looking first in your local repo, then in your corporate, then finally in maven-central. Each time it runs it will download the dependency to your local repo so it is ready next time.
这篇关于依赖关系和存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!