配置本地nexus服务器以从其他远程nexus存储库下载工件

时间:2018-11-18 08:07:29

标签: java maven nexus broadleaf-commerce

我已经在本地安装了Nexus存储库,并配置了Maven以使用我的Nexus存储库。我正在尝试安装阔叶贸易,但总是收到错误消息。阔叶演示:https://github.com/BroadleafCommerce/DemoSite

当我使用默认的Maven设置文件构建项目时,我可以构建该项目。但是使用本地本地存储库,我无法下载阔叶文物。谁能帮我设置的问题?

我的settings.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 个答案:

答案 0 :(得分:1)

您有2个选项,具体取决于您要如何处理。

如果您的联系还应包含Broadleafcommerce的工件,则必须将其添加为代理存储库:

在Nexus中,创建一个ID为Proxy Repository,URL为broadleafcommerce和版本策略为http://nexus.broadleafcommerce.org/nexus/content/groups/public的{​​{1}} 在您的Mixed中定义您的镜像:

settings.xml

如果您要在您的关系存储库中包含来自Broadleafcommerce的工件:

以这种方式定义镜子:

<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>

请注意,<mirrors> <mirror> <id>nexus-group</id> <mirrorOf>*,!broadleaf-repo</mirrorOf> <url>http://localhost:8081/repository/maven-proxy-test/</url> </mirror> </mirrors> 指向您定义的存储库的ID,并将其排除在外。