Настройте локальный сервер Nexus для загрузки артефактов из другого удаленного хранилища Nexus

Я установил хранилище Nexus локально и настроил maven для использования моего хранилища Nexus. Я пытаюсь установить широкополосную коммерцию, но всегда получаю сообщение об ошибке. Демонстрация Broadleaf: https://github.com/BroadleafCommerce/DemoSite.

Когда я собираю проект с файлом настроек по умолчанию maven, я могу создать проект. Но с локальным репозиторием Nexus я не смог скачать широколистные артефакты. Может кто-нибудь помочь мне, что не так с моими настройками?

Мои настройки.xml

<settings>
<mirrors>
<mirror>
  <!--This sends everything else to /public -->
  <id>nexus</id>
  <mirrorOf>*</mirrorOf>
  <url>http://localhost:8081/repository/maven-proxy-test/</url>
</mirror>
</mirrors>
<profiles>
<profile>
  <id>nexus</id>
  <!--Enable snapshots for the built in central repo to direct -->
  <!--all requests to nexus via the mirror -->
  <repositories>
    <repository>
      <id>central</id>
      <url>http://central</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </repository>
<repository>
      <id>broadleaf-repo</id>
      <url>http://nexus.broadleafcommerce.org/nexus/content/groups/public</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
   </repository>
  </repositories>
 <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <url>http://central</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
<pluginRepository>
      <id>broadleaf-repo</id>
      <url>http://nexus.broadleafcommerce.org/nexus/content/groups/public</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
  </pluginRepositories>
</profile>
 </profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>

Когда я собираю проект с широким листом, я всегда получаю ошибку сборки.

INFO] Reactor Summary:
[INFO] 
[INFO] Broadleaf Spring Boot Community Demo 1.0.0-SNAPSHOT  SUCCESS [  0.612 s]
[INFO] Community Demo Core ................................ FAILURE [  0.652 s]
[INFO] Community Demo Site ................................ SKIPPED
[INFO] Community Demo Admin ............................... SKIPPED
[INFO] Community Demo API 1.0.0-SNAPSHOT .................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.885 s
[INFO] Finished at: 2018-11-18T18:48:31+11:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project boot-community-demo-core: Could not resolve dependencies for project com.mycompany-community:boot-community-demo-core:jar:1.0.0-SNAPSHOT: Failed to collect dependencies at org.broadleafcommerce:broadleaf-framework:jar:5.2.7-SNAPSHOT -> org.broadleafcommerce:broadleaf-common:jar:5.2.7-SNAPSHOT -> org.broadleafcommerce:broadleaf-common-presentation:jar:1.0.4-SNAPSHOT: Failed to read artifact descriptor for org.broadleafcommerce:broadleaf-common-presentation:jar:1.0.4-SNAPSHOT: Failure to find org.broadleafcommerce:broadleaf-module-parent:pom:1.0.13-GA in http://localhost:8081/repository/maven-proxy-test/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project boot-community-demo-core: Could not resolve dependencies for project com.mycompany-community:boot-community-demo-core:jar:1.0.0-SNAPSHOT: Failed to collect dependencies at org.broadleafcommerce:broadleaf-framework:jar:5.2.7-SNAPSHOT -> org.broadleafcommerce:broadleaf-common:jar:5.2.7-SNAPSHOT -> org.broadleafcommerce:broadleaf-common-presentation:jar:1.0.4-SNAPSHOT

1 ответ

Решение

У вас есть 2 варианта и зависит от того, как вы хотите справиться с этим.

Если ваш нексус также должен содержать артефакты от broadleafcommerce, вы должны добавить его в качестве прокси-хранилища:

В Nexus создайте Proxy Repository с удостоверением личности broadleafcommerceURL http://nexus.broadleafcommerce.org/nexus/content/groups/public и версия политики MixedВ вашем settings.xml определить ваши зеркала:

<mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*,!broadleaf-repo</mirrorOf>
      <url>http://localhost:8081/repository/maven-proxy-test/</url>
    </mirror>
    <mirror>
      <id>broadleafcommerce</id>
      <mirrorOf>broadleaf-repo</mirrorOf>
      <url>http://nexus.broadleafcommerce.org/nexus/content/groups/public/</url>
    </mirror>
</mirrors>

Если вы не хотите, чтобы артефакты от broadleafcommerce находились в вашем хранилище Nexus:

Определите свое зеркало таким образом:

<mirrors>
    <mirror>
      <id>nexus-group</id>
      <mirrorOf>*,!broadleaf-repo</mirrorOf>
      <url>http://localhost:8081/repository/maven-proxy-test/</url>
    </mirror>
</mirrors>

Заметить, что <mirrorOf>*,!broadleaf-repo</mirrorOf> указывает на идентификатор вашего определенного хранилища и исключает его.

Другие вопросы по тегам