如果公司基于安全因素考虑,要求使用通过安全认证的代理服务器访问因特网,这种情况夏,需要为 Maven 配置HTTP代理,才能让他正常访问外部仓库,配置代理服务器需要在~/.ms2/settings.xml 文件中,添加代理配置:

 
 

<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">

  <!-- proxies

| This is a list of proxies which can be used on this machine to connect to the network.

| Unless otherwise specified (by system property or command-line switch), the first proxy

| specification in this list marked as active will be used.

|-->

    <proxies>

        <proxy>

            <!-- 代理名称 -->

            <id>optional</id>

            <!-- 代理激活状态 -->

            <active>true</active>

            <!-- 代理协议 -->

            <protocol>http</protocol>

            <!-- 认证用户名称 -->

            <username>proxyuser</username>

            <!-- 认证用户密码 -->

            <password>proxypass</password>

            <!-- 代理服务器地址 -->

            <host>proxy.host.net</host>

            <!-- 代理服务器端口 -->

            <port>80</port>

            <!-- 指定域名不需要通过代理 -->

            <nonProxyHosts>local.net|some.host.com</nonProxyHosts>

        </proxy>

 </settings>

 
 

笔记:Maven 设置代理配置的更多相关文章

  1. 学习笔记——Maven settings.xml 配置详解

    文件存放位置 全局配置: ${M2_HOME}/conf/settings.xml 用户配置: ${user.home}/.m2/settings.xml note:用户配置优先于全局配置.${use ...

  2. 学习笔记——Maven pom.xml配置详解

    POM的全称是“ProjectObjectModel(项目对象模型)”. pom.xml详解 声明规范 <projectxmlns="http://maven.apache.org/P ...

  3. Maven设置代理

    很多时候电信的网络对于出国不太稳定,针对一些库下载速度比较慢,所以在使用SSR出国时配置maven使用是一种不错的选择.当然,还有另一种选择,就是使用国内的镜像库. 操作步骤: 1.打开{M2_HOM ...

  4. nginx设置代理配置

    server {                 listen  8086;                 resolver 8.8.8.8;                 location /{ ...

  5. 详解Maven用户的配置settings.xml

    Maven用户设置 作者其他技术文章 1)Oracle性能优化之查询语句通用原则 2)Redis常用命令 3) SpringCloud入门之常用的配置文件 application.yml和 boots ...

  6. maven下载、配置和安装

    Maven简介 #Apache Maven is a software project management and comprehension tool. Based on the concept ...

  7. Maven相关内容学习笔记一:基本配置和使用

    首先必须推荐的这本书<Maven实战> 许晓斌,机械工业出版社 Maven简介 其实使用Maven也有很久时间了,大部分都是别人建好了工程我使用一下,实际上并没有非常详细的使用经验,这次到 ...

  8. 学习笔记-[Maven实战]-第二章:Maven安装和配置

    在windows上安装Maven 1.检查JDK安装:在CMD下运行以下命令来检查JAVA安装情况: 命令: C:\Documents and Settings\Administrator>ec ...

  9. (二)初探Maven之设置代理和阿里云镜像

    引言:           在许多公司,可能因为安全性的要求配置了代理服务器,用户无法直接访问外网,所以在项目中使用Maven必须设置好代理才能下载依赖.           并且直接从中央仓库下载依 ...

随机推荐

  1. mysql常用基础操作语法(五)--对数据的简单条件查询【命令行模式】

    1.单条件查询:select 字段名 from tablename where 条件: 2.简单多条件查询,使用&&或者between and等: 3.is null和is not n ...

  2. HighCharts之2D圆环图

    HighCharts之2D圆环图 1.实例源码 Donut.html: <!DOCTYPE html> <html> <head> <meta charset ...

  3. Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWo

    1.错误描述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help ...

  4. List、Map和Set的实现类

    List.Map和Set的实现类 1.List实现类 (1)ArrayList (2)Vector 2.Map实现类 (1)HashMap (2)Hashtable 3.Set实现类 (1)HashS ...

  5. Linux显示指定区块大小为1024字节

    Linux显示指定区块大小为1024字节 youhaidong@youhaidong-ThinkPad-Edge-E545:~$ df -k 文件系统 1K-blocks 已用 可用 已用% 挂载点 ...

  6. Linux显示用户的ID

    Linux显示用户的ID youhaidong@youhaidong-ThinkPad-Edge-E545:~$ id uid=1000(youhaidong) gid=1000(youhaidong ...

  7. 完美的js运动框架

    //完美运动框架, 对象,json,函数function move(obj,json,funEnd){clearInterval(obj.timer);//清除定时器obj.timer= setInt ...

  8. 浅谈Javascript中的Label语句

    如: begin: for (var i = 0; i < 10 ; i++ ){ alert(i); } 举一个比较典型的例子,看完后即明白 Label 的应用:(未添加 Label) var ...

  9. RabbitMQ教程C#版 - Hello World

    先决条件 本教程假定RabbitMQ已经安装,并运行在localhost标准端口(5672).如果你使用不同的主机.端口或证书,则需要调整连接设置. 从哪里获得帮助 如果您在阅读本教程时遇到困难,可以 ...

  10. 如何通过Spring Boot配置动态数据源访问多个数据库

    之前写过一篇博客<Spring+Mybatis+Mysql搭建分布式数据库访问框架>描述如何通过Spring+Mybatis配置动态数据源访问多个数据库.但是之前的方案有一些限制(原博客中 ...