maven 编译时设置代理
这个 settings.xml 文件放在 C:\Users\username.m2 路径下
bash
<?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>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<username>user</username> <!-- Put your username here -->
<password>pass</password> <!-- Put your password here -->
<host>123.45.6.78</host> <!-- Put the IP address of your proxy server here -->
<port>80</port> <!-- Put your proxy server's port number here -->
<nonProxyHosts>local.net|some.host.com</nonProxyHosts> <!-- Do not use this setting unless you know what you're doing. -->
</proxy>
</proxies>
</settings>
导航至Maven > Importing。在IntelliJ IDEA设置中(位于File > Settings下)。
Maven > Importing中的倒数第二个选项是名为"导入程序的VM选项"的字段。将以下内容附加到已存在的内容中:
-DproxySet=true -DproxyHost=127.0.0.1 -DproxyPort=1081
处,将127.0.0.1替换为您的代理服务器
在Maven > Runner
下执行相同操作