阿里云Maven仓库配置,Maven镜像配置

Jenkins通过maven对java代码打包编译时,速度太慢,所以修改为阿里的Maven仓库

修改如下:

[root@7mini-node2 conf]# vim /software/apache-maven-3.5.3/conf/settings.xml

<mirrors>  
    <!-- mirror  
     | Specifies a repository mirror site to use instead of a given repository. The repository that  
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used  
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.  
     |  
    <mirror>  
      <id>mirrorId</id>  
      <mirrorOf>repositoryId</mirrorOf>  
      <name>Human Readable Name for this Mirror.</name>  
      <url>http://my.repository.com/repo/path</url>  
    </mirror>  
     -->  
     <mirror>  
      <id>alimaven</id>  
      <mirrorOf>central</mirrorOf>  
      <name>aliyun maven</name>  
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
    </mirror>  
  </mirrors>  

  

二、本地Jar包仓库配置

在setting.xml文件中找点localRepository节点,具体配置如下:

路径自己定义

<!-- localRepository  
 | The path to the local repository maven will use to store artifacts.  
 |  
 | Default: ${user.home}/.m2/repository  
<localRepository>/path/to/local/repo</localRepository>  
-->  
<localRepository>\data\repository</localRepository>     #替换掉上面的路径

三、pom.xml文件仓库配置 

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

  

猜你喜欢

转载自www.cnblogs.com/jimmy-xuli/p/9072825.html