Gradle 下载 Archiva 仓库的时候提示错误不能下载

错误提示如下:

A problem occurred configuring root project 'reoc'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not determine artifacts for org.asciidoctor.convert:org.asciidoctor.convert.gradle.plugin:2.3.0
      > Could not get resource 'https://maven.ossez.com/repository/internal/org/asciidoctor/convert/org.asciidoctor.convert.gradle.plugin/2.3.0/org.asciidoctor.convert.gradle.plugin-2.3.0.jar'.
         > Could not HEAD 'https://maven.ossez.com/repository/internal/org/asciidoctor/convert/org.asciidoctor.convert.gradle.plugin/2.3.0/org.asciidoctor.convert.gradle.plugin-2.3.0.jar'. Received status code 500 from server: Unable to fetch artifact resource.


这个问题怎么处理


在这里,你需要注意的 Archiva 返回的错误代码是 500。

如果返回的代码是 404 说明的是资源没有找到,返回 500 的意思是服务器上有错。

Received status code 500 from server: Unable to fetch artifact resource.

登录服务器后,我们看到错误信息是:

2020-04-12 08:50:22,335 [qtp1096639601-25] ERROR org.apache.archiva.webdav.ArchivaDavResourceFactory [] - Failures occurred downloading from some remote repositories:
        Spring-Plugins: Download failure on resource [http://repo.spring.io/plugins-release/org/asciidoctor/convert/org.asciidoctor.convert.gradle.plugin/2.3.0/org.asciidoctor.convert.gradle.plugin-2.3.0.jar]:Access denied to: http://repo.spring.io/plugins-release/org/asciidoctor/convert/org.asciidoctor.convert.gradle.plugin/2.3.0/org.asciidoctor.convert.gradle.plugin-2.3.0.jar , ReasonPhrase:Forbidden.
        central: Download failure on resource [http://central.maven.org/maven2/org/asciidoctor/convert/org.asciidoctor.convert.gradle.plugin/2.3.0/org.asciidoctor.convert.gradle.plugin-2.3.0.jar]:central.maven.org (cause: java.net.UnknownHostException: central.maven.org)
org.apache.archiva.policies.ProxyDownloadException: Failures occurred downloading from some remote repositories:
        Spring-Plugins: Download failure on resource [http://repo.spring.io/plugins-release/org/asciidoctor/convert/org.asciidoctor.convert.gradle.plugin/2.3.0/org.asciidoctor.convert.gradle.plugin-2.3.0.jar]:Access denied to: http://repo.spring.io/plugins-release/org/asciidoctor/convert/org.asciidoctor.convert.gradle.plugin/2.3.0/org.asciidoctor.convert.gradle.plugin-2.3.0.jar , ReasonPhrase:Forbidden.
        central: Download failure on resource [http://central.maven.org/maven2/org/asciidoctor/convert/org.asciidoctor.convert.gradle.plugin/2.3.0/org.asciidoctor.convert.gradle.plugin-2.3.0.jar]:central.maven.org (cause: java.net.UnknownHostException: central.maven.org)
        at org.apache.archiva.proxy.DefaultRepositoryProxyConnectors.fetchFromProxies(DefaultRepositoryProxyConnectors.java:366) ~[archiva-proxy-2.2.3.jar:?]
        at org.apache.archiva.webdav.ArchivaDavResourceFactory.fetchContentFromProxies(ArchivaDavResourceFactory.java:818) [archiva-webdav-2.2.3.jar:?]
        at org.apache.archiva.webdav.ArchivaDavResourceFactory.processRepository(ArchivaDavResourceFactory.java:627) [archiva-webdav-2.2.3.jar:?]
        at org.apache.archiva.webdav.ArchivaDavResourceFactory.createResource(ArchivaDavResourceFactory.java:324) [archiva-webdav-2.2.3.jar:?]
        at org.apache.archiva.webdav.RepositoryServlet.service(RepositoryServlet.java:125) [archiva-webdav-2.2.3.jar:?]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) [javax.servlet-3.0.0.v201112011016.jar:?]
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) [jetty-servlet-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501) [jetty-servlet-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) [jetty-security-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428) [jetty-servlet-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.Server.handle(Server.java:370) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644) [jetty-http-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) [jetty-http-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) [jetty-server-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667) [jetty-io-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) [jetty-io-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) [jetty-util-8.1.14.v20131031.jar:8.1.14.v20131031]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) [jetty-util-8.1.14.v20131031.jar:8.1.14.v20131031]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]

因为我们使用的是 Archiva 为 proxy 代理服务器,这说明 Archiva 没有办法从原数据中下载信息。

从上面的信息,我们可以看到你的 Central Maven 仓库设置有问题,或者原 Central Maven 仓库已经不可用了。

需要将不可用访问的 http://central.maven.org/maven2 仓库 URL 替换为: https://repo1.maven.org/maven2/ 仓库地址。

https://www.cwiki.us/display/MavenZH/questions/57938999

原文地址:https://www.cnblogs.com/huyuchengus/p/12690007.html