配置本地 Nexus 服务器以从其他远程 Nexus 存储库下载工件
Configure local nexus server to download artifacts from other remote nexus repository
我已经在本地安装了 Nexus 存储库并配置了 maven 以使用我的 Nexus 存储库。我正在尝试安装 broadleaf commerce,但总是出现错误。阔叶树演示:https://github.com/BroadleafCommerce/DemoSite。
当我使用默认的 maven 设置文件构建项目时,我可以构建项目。但是使用 nexus local repo,我无法下载阔叶工件。谁能帮我看看我的设置有什么问题吗?
我的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>
当我构建 broadleaf 项目时,我总是遇到构建错误。
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 个选项,具体取决于您希望如何处理它。
如果您的 nexus 还应该保存来自 broadleafcommerce 的工件,您必须将其添加为代理存储库:
在 Nexus 中创建 ID broadleafcommerce
、URL http://nexus.broadleafcommerce.org/nexus/content/groups/public
和版本策略 Mixed
的 Proxy Repository
在你的 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 的工件:
以这种方式定义您的镜像:
<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 并将其排除。
我已经在本地安装了 Nexus 存储库并配置了 maven 以使用我的 Nexus 存储库。我正在尝试安装 broadleaf commerce,但总是出现错误。阔叶树演示:https://github.com/BroadleafCommerce/DemoSite。
当我使用默认的 maven 设置文件构建项目时,我可以构建项目。但是使用 nexus local repo,我无法下载阔叶工件。谁能帮我看看我的设置有什么问题吗?
我的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>
当我构建 broadleaf 项目时,我总是遇到构建错误。
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 个选项,具体取决于您希望如何处理它。
如果您的 nexus 还应该保存来自 broadleafcommerce 的工件,您必须将其添加为代理存储库:
在 Nexus 中创建 ID broadleafcommerce
、URL http://nexus.broadleafcommerce.org/nexus/content/groups/public
和版本策略 Mixed
的 Proxy Repository
在你的 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 的工件:
以这种方式定义您的镜像:
<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 并将其排除。