[英]Maven plugin not using Eclipse's proxy settings
我正在使用基于Eclipse 3.7的springsource工具套件2.7.2。 Maven插件现在开箱即用Eclipse,这很棒,即使使用以前的Eclipse版本也会出现这个问题。
所以这是我的问题:
我已经在settings.xml
文件中设置了代理信息,并且在命令行上Maven工作得很好。 我也在Eclipse配置本身设置了相同的代理详细信息,我知道它是正确的,并且更新与它一起工作,而不是没有。
当然,Eclipse安装中的Maven插件设置为使用正确的settings.xml
文件。
但是eclipse中的maven只是没有使用其中任何一个地方的代理设置,每次更改pom文件时这都非常烦人。 有没有人有这个问题的解决方案?
这是我的settings.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>general</id>
<repositories>
<repository>
<snapshots><enabled>false</enabled></snapshots>
<id>ibiblio</id>
<name>Maven ibiblio</name>
<url>http://www.ibiblio.org/maven2</url>
</repository>
<repository>
<snapshots><enabled>true</enabled></snapshots>
<id>ibiblio2</id>
<name>Maven ibiblio2</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</repository>
<repository>
<snapshots><enabled>true</enabled></snapshots>
<id>maven</id>
<name>Maven sunsite</name>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<snapshots><enabled>true</enabled></snapshots>
<id>jboss</id>
<name>Maven jboss</name>
<url>http://repository.jboss.org/maven2/</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>general</activeProfile>
</activeProfiles>
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>myproxyserver</host>
<port>80</port>
<username>myusername</username>
<password>mypassword</password>
</proxy>
</proxies>
</settings>
Maven插件使用可以设置配置的设置文件。 它的路径在Eclipse的Window|Preferences|Maven|User Settings
可用。 如果该文件不存在,请创建它并添加如下内容:
<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">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers/>
<mirrors/>
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>192.168.1.100</host>
<port>6666</port>
<username></username>
<password></password>
<nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
</proxy>
</proxies>
<profiles/>
<activeProfiles/>
</settings>
编辑文件后,只需单击“ Update Settings
按钮即可完成。 我刚刚完成它并且它有效:)
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
</proxy>
</proxies>
</settings>
窗口>首选项> Maven>用户设置
Eclipse默认情况下不了解您的外部Maven安装并使用嵌入式安装。 因此,为了使Eclipse能够使用全局设置,您需要在菜单Settings → Maven → Installations中进行 设置 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.