为maven设置代理

如果服务器是通过代理上网的,可以通过一下方式设置避免服务器不能联网安装依赖问题

# more /usr/local/maven/conf/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> 
  <pluginGroups>
  </pluginGroups>
  <proxies>
   <proxy>
      <id>ccproxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>10.9.4.199</host>
      <port>808</port>
      <nonProxyHosts>127.0.0.1</nonProxyHosts>
    </proxy>
  </proxies>
  <servers>
  </servers>
  <mirrors>
    <mirror>
      <id>nexus-aliyun</id>
      <mirrorOf>*</mirrorOf>
      <name>Nexus aliyun</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
  <profiles>
  </profiles>
</settings>

 

posted @ 2021-04-01 10:29  reblue520  阅读(469)  评论(0编辑  收藏  举报