Intellij中使用代理

  • Intellij中使用maven在一些网站不能下载,例如下面的错误Connection timed out: connect -> [Help 1]:
[ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.17 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plugin:jar:2.17: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.17 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.40.215] failed: Connection timed out: connect -> [Help 1]
  • 因为我使用了shadowsocksR科学上网,我在浏览器中是能访问“https://repo.maven.apache.org/maven2”,尽管设置的是全局模式,但是Intellij 就是报错Connection timed out。通过下面方法解决了这个问题:
  • 在“C:\Users\Rail.m2\setting.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">
   <proxies>
   <proxy>
      <id>example-proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>localhost</host>
      <port>1080</port>
      <username>***.***.**.***:****</username>
      <password>*******</password>
      <nonProxyHosts>www.baidu.com|*.example.com</nonProxyHosts>
    </proxy>
  </proxies>
</settings>

来源:Maven Configuring a proxy

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值