Java maven 无法传输工件,未授权,ReasonPhrase:Unauthorized

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19176944/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 14:46:07  来源:igfitidea点击:

maven Could not transfer artifact, Not authorized, ReasonPhrase:Unauthorized

javamaven

提问by tokhi

I added below dependency in pom.xmlfile:

我在pom.xml文件中添加了以下依赖项:

<dependency>
  <groupId>org.tuckey</groupId>
  <artifactId>urlrewritefilter</artifactId>
  <version>4.0.4</version>
</dependency>

I have alot of maven dependencies but when I add the one above I get:

我有很多 Maven 依赖项,但是当我添加上面的依赖项时,我得到:

Failed to read artifact descriptor for org.tuckey:urlrewritefilter:jar:4.0.4: Could not transfer artifact org.tuckey:urlrewritefilter:pom:4.0.4 from/to central (http://app1.stage.server.net/artifactory/libs-release): Not authorized, ReasonPhrase:Unauthorized. -> [Help 1]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

this is how the settings.xmlfile looks:

这是settings.xml文件的外观:

..
  <servers>
    <server>
      <username>user</username>
      <id>central</id>
      <password>my-password</password>
    </server>
    <server>
      <username>user</username>
      <id>snapshots</id>
      <password>my-password</password>
    </server>
  </servers>
  <profiles>
    ...
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
..

any help? tnx.

有什么帮助吗?tnx。

回答by Ujjwal

I faced this issue when my proxy server was not configured correctly for maven. You should check with your network administrator about proxy server and add the it in settings.xmlunder conf dir.

当我的代理服务器没有为 Maven 正确配置时,我遇到了这个问题。您应该向您的网络管理员咨询有关代理服务器的信息,并将其添加到settings.xmlconf 目录下。

You can look for <proxies>tag and update the fields.

您可以查找<proxies>标记并更新字段。

When I face this issue, I too felt it happened for just a few jars, but then all other required jar files were already present in my local repository and hence I was getting it for a few jars only.

当我遇到这个问题时,我也觉得它只发生在几个 jar 中,但是所有其他必需的 jar 文件都已经存在于我的本地存储库中,因此我只为几个 jar 获取了它。

回答by Phyxx

I had this error trying to deploy to an internal instance of Nexus with a Maven client that was using proxies with no settings. Attempting to access a Nexus instance on the LAN via a proxy resulted in the Not authorized, ReasonPhrase:Unauthorizederror.

我在尝试使用没有设置的代理的 Maven 客户端部署到 Nexus 的内部实例时遇到了这个错误。尝试通过代理访问 LAN 上的 Nexus 实例导致Not authorized, ReasonPhrase:Unauthorized错误。

<nonProxyHosts>internal.hostname</nonProxyHosts>fixed the issue.

<nonProxyHosts>internal.hostname</nonProxyHosts>解决了这个问题。

回答by Atul Jain

Please check access of repository or password which had given in settings.xml

请检查 settings.xml 中提供的存储库或密码的访问权限

回答by Steve

Adding this in case it helps someone else. In my case I was receiving this error and none of the solutions I found seemed to help. In the end I needed to add the config option to settings.xml to set interactiveMode to false.

添加这个以防它帮助其他人。在我的情况下,我收到了这个错误,我找到的解决方案似乎都没有帮助。最后,我需要将配置选项添加到 settings.xml 以将交互模式设置为 false。