Spring Tool Suite Mavenでネットワークエラー
プロキシを使用している場合
たとえば、mvn -U clean で、以下のようなエラー
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring JPA Utility
[INFO] task-segment: [clean]
[INFO] ------------------------------------------------------------------------
Downloading: http://repository.codehaus.org//org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository Codehaus (http://repository.codehaus.org/): Error transferring file: repository.codehaus.org
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
Downloading: http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository EclipseLink Repo (http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo): Error transferring file: www.eclipse.org
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
:
Eclipse のプロキシ設定を行っても解決しない
<<ref_imageプラグインは存在しません。>>
<<ref_imageプラグインは存在しません。>>
直接Mavenの設定ファイルを編集する
- C:\springsource\maven-2.2.1.RELEASE\conf\settings.xml
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<!--username>proxyuser</username -->
<!--password>proxypass</password -->
<host>192.168.99.99</host>
<port>8080</port>
<nonProxyHosts>127.0.0.1</nonProxyHosts>
</proxy>
</proxies>
さらに、編集したファイルをSTSのプロパティから指定する
- 上記だけだと、Missing artifactエラーがたくさん出る(STS上からの利用に反映されていないので当然か)
- Maven - User Sttings に上記のsettings.xmlを指定
もしくは上記のsettings.xmlをローカルリポジトリ(%ユーザーディレクトリ%\.m2\setting.xml)にコピーして使用
<<ref_imageプラグインは存在しません。>>

YAGI Hiroto (piroto@a-net.email.ne.jp)
twitter http://twitter.com/pppiroto
Copyright© 矢木 浩人 All Rights Reserved.