maven中的坐标和仓库

一 构建与坐标
构建通过坐标作为其唯一标识。
坐标通常由下面三个元素共同组成。
<groupId>com.cakin24.maven01</groupId>
<artifactId>maven01-model</artifactId>
<version>0.0.1SNAPSHOT</version>
 
二 仓库
用来管理项目依赖,仓库分本地仓库和远程仓库两类: 本地仓库和 远程仓库。
如果在本地仓库中找不到依赖,会到全球中央仓库去查找,查找到后,就会下载到本地仓库中。如果找不到,就会报错。
全球中央仓库地址: https://repo.maven.apache.org/maven2
 
三 镜像仓库的配置方法
1 Maven 的安装目录下的 conf 文件下有个settings.xml文件,编辑该文件.
2 在该文件中插入下面代码片段
<mirror>
    <id>net-cn</id>
    <mirrorOf>central</mirrorOf>
    <name>Human Readable Name for this Mirror.</name>
</mirror>
 
四 更改仓库位置
仓库默认存放位置: C:\Users\lenovo\.m2\repository
1 Maven 的安装目录下的 conf 文件下有个settings.xml文件,编辑该文件.
2 在该文件中插入下面代码片段
<localRepository>F:/java/repo</localRepository>
3 将 settings.xml 文件复制到 F:\java\repo目录中

猜你喜欢

转载自cakin24.iteye.com/blog/2393147