Why am I getting a “401 Unauthorized” error in Maven?

前端 未结 21 1833
栀梦
栀梦 2020-11-29 18:06

Why am I getting a \"401 Unauthorized\" error in Maven?

Here\'s the error I\'m getting when calling mvn deploy (full logs at the bottom):

21条回答
  •  被撕碎了的回忆
    2020-11-29 18:30

    One of the reasons for this error is when repositoryId is not specified or specified incorrectly. As mentioned already it should be the same as in section in settings.xml. Couple of hints... Run mvn with -e -X options and check the debug output. It will tell you which repositoryId it is using:

    [DEBUG]   (f) offline = false
    [DEBUG]   (f) packaging = exe
    [DEBUG]   (f) pomFile = c:\temp\build-test\pom.xml
    [DEBUG]   (f) project = MavenProject: org.apache.maven:standalone-pom:1 @ 
    [DEBUG]   (f) repositoryId = remote-repository
    [DEBUG]   (f) repositoryLayout = default
    [DEBUG]   (f) retryFailedDeploymentCount = 1
    [DEBUG]   (f) uniqueVersion = true
    [DEBUG]   (f) updateReleaseInfo = false
    [DEBUG]   (f) url = https://nexus.url.blah.com/...
    [DEBUG]   (f) version = 13.1
    [DEBUG] -- end configuration --
    

    In this case it uses the default value "remote-repository", which means that something went wrong.

    Apparently I have specified -DrepositoryID (note ID in capital) instead of -DrepositoryId.

提交回复
热议问题