如何解决Nexus没有从exists-db数据库的已添加存储库中找到工件的问题?

时间:2017-06-29 14:44:47

标签: java maven nexus exist-db

当我在我的pom.xml中为我的项目添加eXist-db工件的依赖项时,如the official place for eXist artifacts所述,一切都按预期工作。以下是添加到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/作为远程存储位置时,我收到了Remote Automatically Blocked and Unavailable消息。顺便说一下,该链接被重定向到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

所以,当我尝试将此repo URL放在Web浏览器中时,我得到了400: Invalid request正如预期的那样。

我猜测这不是Nexus中代理存储库的正确链接,因为Nexus需要该链接上的工件列表。所以,我已将其更改为https://github.com/eXist-db/mvn-repoRemote 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)

最后,在我的exists-db代理存储库的Routing选项卡下的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

有人可以告诉我,我在这里失踪了吗? 感谢。

1 个答案:

答案 0 :(得分:1)

遗憾的是,原始的GitHub repo仅适用于mvn命令行工具。它不能用作Nexus repo代理的来源。

  

然而,我的公司维护一个包含公共Nexus仓库的公共Nexus仓库   最新的eXist文物:   http://repo.evolvedbinary.com/content/repositories/exist-db/

虽然上述网址仍然有效,但我们现在更新为Nexus 3,它更喜欢较新的网址样式现在应该可以访问存储库:http://repo.evolvedbinary.com/repository/exist-db/