49

コードを Nexus リポジトリ リポジトリからチェックアウトしました。アカウントのパスワードを変更し、settings.xmlファイル内で正しく設定しました。実行中に、そのリポジトリからファイルをダウンロードしようとするとmvn install cleanエラーが発生します。Not authorized, ReasonPhrase:Unauthorized

このエラーを解決する方法はありますか? Maven 3.04 で Windows 7 を使用しています

4

7 に答える 7

38

この問題は、リモート リポジトリから依存関係を取得しているときに発生する可能性があります。私の場合、リポジトリは認証を必要とせず、settings.xml ファイルのサーバー セクションを削除することで解決されました。

<servers>
    <server>
      <id>SomeRepo</id>
      <username>SomeUN</username>
      <password>SomePW</password>
    </server>
</servers>

ps: あなたのターゲットはmaven install cleanではなくmvn clean installだと思います

于 2012-06-06T14:19:49.803 に答える
20

I have recently encountered this problem. Here are the steps to resolve

  1. Check the servers section in the settings.xml file.Is username and password correct?

<servers>
  <server>
    <id>serverId</id>
    <username>username</username>
    <password>password</password>
  </server>
</servers>

  1. Check the repository section in the pom.xml file.The id of the server tag should be the same as the id of the repository tag.

<repositories>
	<repository>
	  <id>serverId</id>  
	  <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
	</repository>
</repositories>

  1. If the repository tag is not configured in the pom.xml file, look in the settings.xml file.

<profiles>
	<profile>
	  <repositories>
	    <repository>
		    <id>serverId</id>
		    <name>aliyun</name>
		    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
	    </repository>
	  </repositories>
	</profile>
</profiles>

Note that you should ensure that the id of the server tag should be the same as the id of the repository tag.

于 2019-02-26T08:11:51.570 に答える
13

ここでの問題は、使用されているパスワードのタイプミスでした。これは、パスワードに使用されている文字/文字が原因で簡単に識別できませんでした。

于 2012-09-26T04:53:01.967 に答える