maven - 当它有父pom时如何正确地将工件部署到nexus?
问题描述
我在将我的工件部署到 nexus 时遇到问题。我正在使用来自 sonatype 的 maven 和 nexus-staging-maven-plugin。我的项目结构是:父 A 有 2 个子模块 B 和 C。在 BI 的 pom.xml 中声明了如下插件(当然还有存储库等):
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<configuration>
<nexusUrl>http://nexus.intranet:8081/repository/myrepo/</nexusUrl>
<serverId>nexus</serverId>
<skipStaging>true</skipStaging>
</configuration>
</plugin>
我的工件正在正确部署到 nexus 文件夹 com/myorg/B/1.1.5/ 并且存在 jar 和 B 的 pom.xml 和 sha 文件。问题是,当我添加到另一个项目依赖项 B 时,该项目试图在 nexus A(B 的父 pom)中找到。我也应该将父 pom.xml 部署到我的关系吗?我应该如何在 B pom.xml 中配置我的插件才能正确执行?
解决方案
我已经解决了我的问题。答案是肯定的——如果你想在某个地方使用子模块作为依赖项,你也需要在存储库中拥有它的父 pom。我通过从 sonatype 添加到我的父 pom 暂存插件来解决问题,以便也可以将父 pom 部署到 nexus。比构建成功,现在我可以使用我的子工件(在我的问题中名为 B)作为另一个项目的依赖项。
推荐阅读
- powerbi - PowerBI - 将 DAX 度量更改为 Power Query M 编辑器自定义列
- laravel - 如何向 Laravel Jetstream 团队添加软删除和强制删除
- maven - Gradle 构建失败“com.google.common.util.concurrent.ExecutionError:java.lang.NoClassDefFoundError:org/gradle/api/internal/java/JavaLibrary”
- architecture - 清洁架构边界
- ipfs - 如何在捆绑中添加轨道数据库?
- c - Linux C/C++ 应用程序部署
- sqlite - 如何获取查询中一行的最终长度?
- java - 如何在 Selenium chrome webdriver 中获取 iframe cookie
- pandas - 通过分隔符','将数据框列分成多列:expand = True,n =-1
- java - 如何使用 ExecutorService 批量运行任务