MavenプラグインがEclipseのプロキシ設定を使用していない 質問する

MavenプラグインがEclipseのプロキシ設定を使用していない 質問する

私は Eclipse 3.7 をベースにした springsource ツール スイート 2.7.2 を使用しています。Maven プラグインは Eclipse に標準で付属しており、これは素晴らしいことですが、この問題は以前のバージョンの Eclipse でも発生していました。

これが私の問題です:

ファイルにプロキシ情報を設定しましたsettings.xmlが、コマンド ラインでは Maven は正常に動作します。Eclipse 構成自体にも同じプロキシ詳細を設定しましたが、それが正しいことと、それなしでは更新が動作しないことがわかっています。

もちろん、Eclipse インストール内の Maven プラグインは適切なsettings.xmlファイルを使用するように設定されています。

しかし、Eclipse 内の Maven はどちらの場所のプロキシ設定も使用しないため、pom ファイルを変更するたびに非常に煩わしいことになります。この問題の解決策を持っている人はいますか?

設定.xml

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

ベストアンサー1

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完了です。私も今試してみましたが、うまくいきました :)

おすすめ記事