java - 配置本地 Nexus 服务器以从其他远程 Nexus 存储库下载 Artifact

标签 java maven nexus broadleaf-commerce

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

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

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

最佳答案

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

如果您的关系还应该保存来自阔叶商业的 Artifact ,您必须将其添加为代理存储库:

在 Nexus 中创建 Proxy Repository ID broadleafcommerce ,网址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>

如果您希望在您的Nexus存储库中拥有来自broadleafcommerce的 Artifact :

以这种方式定义你的镜像:

<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>指向您定义的存储库的 ID 并将其排除。

关于java - 配置本地 Nexus 服务器以从其他远程 Nexus 存储库下载 Artifact ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53358979/

相关文章:

java - 如何将 <%= ...> 设置为循环计数器?

java - Spring-Security:MySQL JDBC 身份验证失败

java - 如何确定升级依赖项是否会破坏 jar 文件?

java - Maven 版本插件不起作用

java - Spring boot应用程序-Tomcat部署-无法确定合适的驱动程序类

java - Spring Security 测试期间的空身份验证

java - Maven 依赖噩梦

migration - 将存储库从 Sonatype Nexus 1.9 迁移到 3.0

java - Ivy 和 Nexus 的 Sourceforge 组织属性

java - 找不到 spring 4 maven Artifact