maven 阿里云镜像

 镜像:

maven默认会从中央仓库下载jar包,这个仓库在国外,而且全世界的人都会从这里下载,所以下载速度肯定是非常慢的。镜像就相当于是中央仓库的一个副本,内容和中央仓库完全一样,目前有不少国内镜像,其中阿里云算是比较稳定的,同时也能保证下载速度。

配置方法:

在settings.xml 中配置,所有项目都会生效

<mirrors>  
    <mirror>  
      <id>alimaven</id>  
      <name>aliyun maven</name>  
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
      <mirrorOf>central</mirrorOf>          
    </mirror>  
  </mirrors>  

在pom.xml中配置,仅当前项目生效

<repositories>  
 <repository>  
   <id>alimaven</id>   
    <name>aliyun maven</name>        
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
  </repository>  
</repositories>  

私服:

在阿里云下载路径中,可以看到有一个nexus,它实际上是一个nexus私服。我们也可以在公司内网中部署一个这样的nexus私服,项目成员可以直接从内网下载jar包,内网通常比从镜像下载速度更快,而且不用连外网。

https://mvnrepository.com/ 搜索maven依赖地址

posted @ 2020-02-27 18:42  所向披靡zz  阅读(475)  评论(0编辑  收藏  举报