LoginSignup
2
2

More than 1 year has passed since last update.

Maven の repositories に http://~ を指定すると mvn install に失敗する

Posted at

事象

mvn install 実行時に下記のようなエラーになる。

Could not transfer artifact xxx from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [xxxxx (http://xxxxx, default, releases)]

対処

とりあえず http のまま繋ぎたい場合は設定ファイルの下記部分をコメントアウトすればよい。
(repository を HTTPS に対応させるのが良いというのはそう)

settings.xml
  <mirrors>
  ~
    <!-- ↓ この部分をコメントアウト -->
    <mirror>
      <id>maven-default-http-blocker</id>
      <mirrorOf>external:http:*</mirrorOf>
      <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
      <url>http://0.0.0.0/</url>
      <blocked>true</blocked>
    </mirror>
  </mirrors>

※ 設定ファイルの場所

設定ファイルの場所は ~/.m2/settings.xml だが、intellij (の maven プラグイン) を利用している場合は別の場所になる。
Windows で toolbox を利用して intellij を入れている場合は ~\AppData\Local\JetBrains\Toolbox\apps\IDEA-C\ch-0\...\plugins\maven\lib\maven3\conf\settings.xml にありました。
"..." 部分はプロジェクトによって異なるようなのでプロジェクトごとに修正が必要。

原因

3.8.1 からデフォルトで http 接続はブロックされるようになったそうです。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2