Когда я добавляю зависимость для артефактов eXist-db в файл pom.xml для своего проекта, как описано в , официальное место для артефактов eXist все работает как положено. Вот фрагменты, добавленные в 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. Затем я добавил этот репозиторий в группу общедоступных репозиториев. Кроме того, внутри 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.
Вернемся к вопросу. В настройках моего прокси-репозитория для eXist-db внутри Nexus, когда я помещаю https://raw.github.com/eXist-db/mvn-repo/master/ в качестве удаленного хранилища у меня есть сообщение Remote Automatically Blocked and Unavailable
. Кстати, эта ссылка перенаправляется на https://raw.githubusercontent.com/eXist-db/mvn-repo/master/ И из файла wrapper.log Nexus у меня есть эта строка:
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-адрес репо в веб-браузер, я получаю: 400: Invalid request
как и ожидалось.
Я предположил, что это неправильная ссылка для прокси-репозитория в Nexus, потому что Nexus нуждается в списке артефактов по этой ссылке. Итак, я изменил его на 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)
В конце концов, в Nexus на вкладке «Маршрутизация» для моего репозитория прокси-сервера exists-db у меня есть:
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).
И я получил сообщение об ошибке в Eclipse в pom.xml проекта, в котором говорится:
Missing artifact org.exist-db:exist-core:jar:3.2.0
Может кто-нибудь сказать мне, пожалуйста, что мне здесь не хватает? Спасибо.