Maven设置镜像或者代理服务器

时间:2024-04-13 14:27:28 类型:JAVA
字号:    

Maven默认访问无法加载jar包,需要设置镜像服务器或代理服务器

打开maven主目录  conf/setting.xml文件

 <proxies>
   <!--  proxy
     | Specification for one proxy, to be used in connecting to the network.
       设置代理服务器
     | -->
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>127.0.0.1</host>
      <port>7890</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
   
  </proxies>

  

  <!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   | 设置镜像
   |-->
  <mirrors>
       <mirror>
              <id>nexus-aliyun</id>
              <mirrorOf>*</mirrorOf>
              <name>Nexus aliyun</name>
              <url>http://maven.aliyun.com/nexus/content/groups/public</url>
       </mirror>
  </mirrors>


<