上传网站时出错:无法传输文件:<site-url>返回代码为:401 - &gt;

时间:2016-09-29 15:05:30

标签: java maven nexus maven-site-plugin

我无法部署maven-site-plugin制作的网站。

我遇到与此问题类似的错误:Maven site deploy logs filling with [WARNING] Required credentials to nexus 3 但其中有一条评论说该问题已知并在此处报告https://issues.sonatype.org/browse/NEXUS-10112,但此问题已经结束。

我按照教程http://books.sonatype.com/nexus-book/reference/_creating_a_new_maven_project.html一切正常,直到步骤20.6网站:部署。

我发现此问题的唯一“解决方案”是https://benkiew.wordpress.com/2009/11/27/status-code-401-on-mvn-sitedeploy/ 但它不起作用。我的settings.xml和pom.xml匹配,所以不是问题。

settings.xml服务器conf看起来如下:

   </servers>
    <server>        
      <id>nexus</id>        
      <username>XXXX</username>
      <password>XXXX</password>
    </server>
   </servers>

父pom.xml:

      <site>
          <id>nexus</id>
          <name>service-agents-repository</name>
          <url>dav:https://!URL!/repo/content/sites/agents</url>
      </site>

nexus提供的id与上面显示的两个不同,但我也尝试使用该ID,我正在写这个问题所以没有用。 mvn site输出错误:deploy

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Services: IoT agents
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Services: IoT agents 1.3.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-site-plugin:3.5.1:deploy (default-cli) @ parent ---
https://!URL!/repo/content/sites/agents/ - Session: Opened
[INFO] Pushing D:\!URL!\target\site
[INFO]    >>> to https://!URL!/repo/content/sites/agents/./
[WARNING] Required credentials not available for BASIC <any realm>@!URL!:443
[WARNING] Preemptive authentication requested but no default credentials available
[INFO] basic authentication scheme selected
[INFO] Failure authenticating with BASIC 'Sonatype Nexus Repository Manager'@!URL!:443
[WARNING] Required credentials not available for BASIC <any realm>@!URL!:443
[WARNING] Preemptive authentication requested but no default credentials available
[INFO] basic authentication scheme selected
[INFO] Failure authenticating with BASIC 'Sonatype Nexus Repository Manager'@!URL!:443
[WARNING] Required credentials not available for BASIC <any realm>@!URL!:443
[WARNING] Preemptive authentication requested but no default credentials available
[WARNING] Required credentials not available for BASIC <any realm>@!URL!:443
[WARNING] Preemptive authentication requested but no default credentials available
[INFO] basic authentication scheme selected
[INFO] Failure authenticating with BASIC 'Sonatype Nexus Repository Manager'@!URL!:443
 Transfer error: java.io.IOException: Unable to create collection: https://!URL!/repo/content/sites/agents/; status code = 401
Uploading: .//apidocs/allclasses-frame.html to https://!URL!/repo/content/sites/agents/

[WARNING] Required credentials not available for BASIC <any realm>@linksmart.eu:443
[WARNING] Preemptive authentication requested but no default credentials available
#########[INFO] basic authentication scheme selected
[INFO] Failure authenticating with BASIC 'Sonatype Nexus Repository Manager'@!URL!:443
https://!URL!/repo/content/sites/agents/./apidocs/allclasses-frame.html - Status code: 401
 Transfer error: org.apache.maven.wagon.TransferFailedException: Failed to transfer file: https://!URL!/repo/content/sites/agents/./apidocs/allclasses-frame.html. Return code is: 401
https://!URL!/repo/content/sites/agents/ - Session: Disconnecting
https://!URL!/repo/content/sites/agents/ - Session: Disconnected
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Services: IoT agents ........................... FAILURE [  2.352 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.661 s
[INFO] Finished at: 2016-09-29T17:04:57+01:00
[INFO] Final Memory: 19M/219M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.5.1:deploy (default-cli) on project parent: Error uploading site: Failed to transfer file: https://!URL!/repo/content/sites/agents/./apidocs/allclasses-frame.html. Return code is: 401 -> [
Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[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/MojoExecutionException

如果需要更多信息,请询问。

感谢。

2 个答案:

答案 0 :(得分:0)

您似乎已经遵循了Nexus Repository Manager 2的文档。您可以专门针对Nexus 3尝试文档:http://books.sonatype.com/nexus-book/3.0/reference/raw.html#_configuring_maven_for_site_deployment

如果这没有用,请告诉我你正在运行的Nexus 3的版本,我们对3.0.2与3.0.0中的域名进行了一些更改,尽管我不认为这是问题所在。

答案 1 :(得分:0)

对此问题感到抱歉。

有错误。问题是Maven指向错误的settings.xml文件并且没有获取凭据。因此,此处显示的配置很好。

感谢。