Maven插件不使用eclipse的代理设置 [英] Maven plugin not using eclipse's proxy settings

查看:154
本文介绍了Maven插件不使用eclipse的代理设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用springource工具套件2.7.2,基于eclipse 3.7。 maven插件现在开始使用eclipse,这是非常好的,即使以前的eclipse版本也会发生这个问题。



所以这里是我的问题:
我已经在我的settings.xml文件中设置了代理信息,而在命令行中,maven工作正常。我还在eclipse配置本身设置了相同的代理细节,我知道它是正确的,以及更新与它,而不是没有。
当然,我的eclipse中的maven插件设置为使用正确的settings.xml文件。



但是,从eclipse中的maven不会使用任何一个地方的代理设置,这是非常烦人的每次我更改pom文件。
有没有人可以解决这个问题?



Settings.xml



这是我的设置.xml文件:

 <?xml version =1.0encoding =UTF-8 >?; 
< settings xmlns =http://maven.apache.org/POM/4.0.0xmlns:xsi =http://www.w3.org/2001/XMLSchema-instancexsi:schemaLocation =http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd\">

<个人资料>
<个人资料>
< 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>一般< / activeProfile>
< / activeProfiles>

<代理>
<代理>
< id> proxy< / id>
< active> true< / active>
< protocol> http< / protocol>
< host> myproxyserver< / host>
< port> 80< / port>
< username> myusername< / username>
< password> mypassword< / password>
< / proxy>
< /代理>
< / settings>

提前感谢:)

解决方案

Maven插件使用可以设置配置的设置文件。它的路径在Eclipse中可用窗口|首选项| Maven |用户设置。如果文件不存在,创建它并放在这样的位置:

 设置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 />
<代理>
<代理>
< 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>
< /代理>
< profiles />
< activeProfiles />
< / settings>

编辑文件后,只需单击更新设置按钮,它完成了。我刚刚完成它,它的工作:)


I am using springsource tool suite 2.7.2, based on eclipse 3.7. The maven plugin comes now out of the box with eclipse which is great, and this problem occured even with previous version of eclipse.

So here is my issue: I have set the proxy information in my settings.xml file, and in command line maven works just fine. I have also set the same proxy details in the eclipse configuration itself and I know that it is correct as well as the updates work with it and not without. Of course, the maven plugin in my eclipse is set to use the proper settings.xml file.

But maven from within eclipse just doesn't use the proxy settings from either of those places, which is very annoying every time I change the pom file. Does anyone have a solution for this issue ?

Settings.xml

Here is my settings.xml file:

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

Thanks a lot in advance :)

解决方案

Maven plugin uses a settings file where the configuration can be set. Its path is available in Eclipse at Window|Preferences|Maven|User Settings. If the file doesn't exist, create it and put on something like this:

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

After editing the file, it's just a matter of clicking on Update Settings button and it's done. I've just done it and it worked :)

这篇关于Maven插件不使用eclipse的代理设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆