0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Apache archiva 400 Bad Request 404 Not Found 対応メモ

Last updated at Posted at 2023-11-06

概要

Apache archiva経由でMavenCentralへアクセスした際に400 Bad Requestや404Not Foundが出力される場合があります。
RepositoryのDirectoryを絶対パスに修正することで疎通しました。備忘として残しておきます。

環境

Windows 64bit
Java 8
apache-archiva-2.2.10
自宅環境(社内プロキシ設定など無し)

事前準備

今回はデフォルトのリポジトリであるsnapshotsを例に疎通を行っています。
なおsnapshotsはcentralのプロキシがデフォルトでは設定されておらず、これが原因で404になるため事前にプロキシ設定を追加してください(Addボタンを押下してそのままの設定でOKを押下すればよいです)

image.png

設定変更前

Directory ./repositories/snapshots
Index Directory ./repositories/snapshots/.indexer

image.png

ブラウザで以下の様にアクセスすると400エラーが返ってきます。

http://localhost:8080/repository/snapshots/junit/junit/3.8.1/junit-3.8.1.jar
image.png

設定変更後

Directory D:\develop\apache-archiva-2.2.10\repositories\snapshots
Index Directory D:\develop\apache-archiva-2.2.10\repositories\snapshots.indexer

※上記のパスは例です。自身のApache archivaの配置箇所を指定してください
※変更前の区切り記号は「/」ですがWindowsエクスプローラのデフォルトである「\」に揃えています
※Saveを押下した時に1回目はエラー文言が出ますがもう一度押すと通ります
image.png

ダウンロードすることが出来た
※ブラウザでアクセスする際のアドレスは「repositories」ではなく「repository」です

http://localhost:8080/repository/snapshots/junit/junit/3.8.1/junit-3.8.1.jar
image.png

その他

repositories/repositories構造

疎通した後に再度リポジトリの設定画面に遷移してみると「D:\develop\apache-archiva-2.2.10\repositories\repositories\snapshots」と何故か「repositories」が2つ挟まったパスに更新されています。また、Index Directoryのパスが相対パス表記に戻っています。

image.png

生成されたフォルダを見てみると確かに「repositories/repositories」階層となっています。
ミラーリポジトリは「repositories/repositories」配下のsnapshotsで生成されています。

image.png

これは再度絶対パス表記に修正し直すことで解消する様子。
今回は素直に\repositories\snapshots配下に生成したいのでこの様な再修正を行いました。

image.png

以上

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?