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

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

问题描述

我使用的是基于 Eclipse 3.7 的 springsource 工具套件 2.7.2.Maven 插件现在与 Eclipse 一起开箱即用,这很棒,即使在以前的 Eclipse 版本中也会出现这个问题.

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 occurred even with previous version of Eclipse.

所以这是我的问题:

我已经在我的 settings.xml 文件中设置了代理信息,并且在命令行上 Maven 工作得很好.我还在 Eclipse 配置本身中设置了相同的代理详细信息,并且我知道它是正确的,并且更新适用于它而不是没有.

I have set the proxy information in my settings.xml file, and on the 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.

当然,我的 Eclipse 安装中的 Maven 插件设置为使用正确的 settings.xml 文件.

Of course, the Maven plugin in my Eclipse installation is set to use the proper settings.xml file.

但是 eclipse 中的 maven 只是不使用这两个地方的代理设置,这在我每次更改 pom 文件时都非常烦人.有没有人有这个问题的解决方案?

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>

推荐答案

Maven 插件使用一个设置文件,可以在其中设置配置.它的路径在 Eclipse 中的 Window|Preferences|Maven|User Settings 中可用.如果该文件不存在,请创建它并添加如下内容:

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>

编辑文件后,只需点击Update 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天全站免登陆