【maven】仓库配置

Maven配置

Maven仓库类型

本地(local) 中央(central) 远程(remote):自定义仓库

Maven依赖搜索顺序

  1. 在本地仓库搜索
  2. 在中央仓库搜索
  3. 如果设置了远程仓库,则在远程仓库搜索,否则报错

远程仓库在pom.xml中的repositories下设置

<repository>
  <id>spring</id>
  <url>https://maven.aliyun.com/repository/spring</url>
  <releases>
    <enabled>true</enabled>
  </releases>
  <snapshots>
    <enabled>true</enabled>
  </snapshots>
</repository>

字段含义

mirrorof,代表为为某个仓库做镜像
mirrorof = * mirror一切
mirrorof myrepoID,配置的id为myrepoID的仓库失效,使用mirror的url
mirrorof =,!myrepoID 除myrepoID外其他仓库用mirror
mirrorOf=external:
//如果本地库存在就用本地库的,如果本地没有所有下载就用mirror配置的url下载

profiles

可以在profiles下配置各profile,设置repository。再在activeProfiles下配置activeProfile激活对应的配置。

posted @ 2022-04-24 19:12  four_z  阅读(131)  评论(0)    收藏  举报