如何解决 Nexus 未从为 exist-db 数据库添加的存储库中找到工件的问题?

How to solve the issue of Nexus not finding artifacts from added repository for the exist-db database?

当我按照 the official place for eXist artifacts 中的解释在我的 pom.xml 中为我的项目添加对 eXist-db 工件的依赖时,一切都按预期工作。以下是添加到 pom 的片段:

<dependencies>
<dependency>
  <groupId>org.exist-db</groupId>
  <artifactId>exist-core</artifactId>
  <version>3.2.0</version>
</dependency>
</dependencies>

<repositories>
<repository>
  <id>exist</id>
  <url>https://raw.github.com/eXist-db/mvn-repo/master/</url>
</repository>
</repositories>

但是,当我想使用 Nexus (nexus-2.14.4-03) 导入依赖项时,我很难让它工作。在我的项目 pom.xml 中,我删除了存储库元素以使其通过 Nexus 存储库工作。

在 Nexus 中,我为 eXist-db 工件添加了新的代理存储库。比我将该存储库添加到 Public Repositories 组。此外,在 Maven 的 settings.xml 中,我添加了如下镜像代码:

<mirror>
    <id>nexus</id>
    <url>http://localhost:8081/nexus/content/groups/public/</url>
    <mirrorOf>central</mirrorOf>
    <name>Nexus Repository.</name>
</mirror>

Nexus 存储库似乎可以工作。我可以从 Nexus 浏览它,将其视为 Eclipse 的全局存储库,并在浏览器中检查它,其中包含工件列表,eXist-db 除外。

回到问题。在 Nexus 内 eXist-db 的代理存储库设置中,当我输入 https://raw.github.com/eXist-db/mvn-repo/master/ as the Remote Storage Location, I have Remote Automatically Blocked and Unavailable message. Btw that link is redirected to the https://raw.githubusercontent.com/eXist-db/mvn-repo/master/ 并且从 Nexus 的 wrapper.log 文件中我有这一行:

admin org.sonatype.nexus.proxy.maven.maven2.M2Repository - Remote peer of proxy repository "exist-db" [id=exist-db] threw a org.sonatype.nexus.proxy.RemoteStorageException exception. Connection/transport problems occured while connecting to remote peer of the repository. Auto-blocking this repository to prevent further connection-leaks and known-to-fail outbound connections until administrator fixes the problems, or Nexus detects remote repository as healthy. - Cause(s): Unexpected response code while executing GET method [repositoryId="exist-db", requestPath="/", remoteUrl="https://raw.github.com/eXist-db/mvn-repo/master/"]. Expected: "SUCCESS (200)". Received: 400 : Bad Request

因此,当我尝试将此存储库 URL 放入 Web 浏览器时,我得到:400: Invalid request 正如预期的那样。

我猜这不是 Nexus 中代理存储库的正确 link,因为 Nexus 需要那个 link 上的工件列表。因此,我已将其更改为 https://github.com/eXist-db/mvn-repo 并且 Remote Automatically Blocked and Unavailable 消息消失了。这些是日志中的行:

INFO  [proxy-3-thread-24] admin org.sonatype.nexus.proxy.storage.remote.httpclient.HttpClientRemoteStorage - Updating remote transport for proxy repository "exist-db" [id=exist-db]...
WARN  [proxy-3-thread-24] admin org.sonatype.nexus.proxy.maven.maven2.M2Repository - Remote peer of proxy repository "exist-db" [id=exist-db] detected as healthy, un-blocking the proxy repository (it was AutoBlocked by Nexus).
INFO  [qtp16973920-132] admin org.sonatype.nexus.configuration.application.DefaultNexusConfiguration - Applying Nexus Configuration due to changes in [Public Repositories] made by admin...
INFO  [ar-4-thread-1] admin org.sonatype.nexus.proxy.maven.routing.internal.ManagerImpl - Unpublished prefix file of "Public Repositories" [id=public] (and is marked for noscrape)
ERROR [qtp16973920-49] admin org.sonatype.nexus.rest.NexusRestletResource - java.lang.StringIndexOutOfBoundsException: String index out of range: -10
java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:935)
at java.lang.StringBuilder.substring(StringBuilder.java:76) ~[na:1.8.0_131]
at org.sonatype.nexus.plugins.rrb.parsers.HtmlRemoteRepositoryParser.getLinkUrl(HtmlRemoteRepositoryParser.java:173) ~[na:na]
...

比起我尝试从 Nexus 内部更新存储库索引,这些是该操作的日志行:

INFO  [pxpool-1-thread-6] admin org.sonatype.nexus.index.tasks.UpdateIndexTask - Scheduled task (UpdateIndexTask) started :: Updating repository index "exist-db" from path / and below.
INFO  [pxpool-1-thread-6] admin org.sonatype.nexus.index.DefaultIndexerManager - Trying to get remote index for repository "exist-db" [id=exist-db]
INFO  [pxpool-1-thread-6] admin org.sonatype.nexus.index.DefaultIndexerManager - Cannot fetch remote index for repository "exist-db" [id=exist-db] as it does not publish indexes.
INFO  [pxpool-1-thread-6] admin org.sonatype.nexus.index.NexusScanningListener - Scanning of repositoryID="exist-db" started.
INFO  [pxpool-1-thread-6] admin org.sonatype.nexus.index.NexusScanningListener - Scanning of repositoryID="exist-db" finished: scanned=0, added=0, updated=0, removed=0, scanningDuration=0:00:00.328
INFO  [pxpool-1-thread-6] admin org.sonatype.nexus.index.DefaultIndexerManager - Publishing index for repository exist-db
INFO  [pxpool-1-thread-6] admin org.sonatype.nexus.index.tasks.UpdateIndexTask - Scheduled task (UpdateIndexTask) finished :: Updating repository index "exist-db" from path / and below. (started 2017-06-29T15:53:28+02:00, runtime 0:00:01.375)

最后,在我的 exist-db 代理存储库的路由选项卡下的 Nexus 中,我有:

Publishing:
Status: Not published.
Message: Discovery in progress or unable to discover remote content (see discovery status).

Discovery:
Status: Unsuccessful.
Message: No scraper was able to scrape remote (or remote prevents scraping).

我在项目 pom.xml 的 Eclipse 中收到错误消息,指出:

Missing artifact org.exist-db:exist-core:jar:3.2.0

有人可以告诉我我在这里缺少什么吗? 谢谢。

不幸的是,原始 GitHub 存储库仅适用于 mvn 命令行工具。它不能作为 Nexus 回购代理的来源。

However, my company maintain a public Nexus repo which contains the latest eXist artifacts here: http://repo.evolvedbinary.com/content/repositories/exist-db/

虽然上面的 URL 仍然有效,但我们现在已经更新到 Nexus 3,它更喜欢更新的 URL 样式现在应该从以下位置访问存储库:http://repo.evolvedbinary.com/repository/exist-db/