java - 未使用 Maven settings.xml
问题描述
我正在创建一个包含父 pom 的 maven 模块。这个父工件存储在一个 nexus maven 存储库中。我将 nexus 存储库添加到我的 settings.xml 中。现在,如果我正在构建我的子模块,我会遇到错误:
Could not find artifact test:my.parent:pom:1.0
似乎settings.xml
默认情况下不使用 。如果我添加
<repositories><repository><id>random</id><url>http://test/repository/maven-releases/</url></repository></repositories>
到我的孩子的 pom 中一切正常,则使用 settings.xml 并找到父工件。
我是否遗漏了默认情况下将使用 settings.xml 的任何内容,或者这是预期的行为?我不想将这个随机 repo 标签添加到我的每个子 pom 中。
家长会:
<groupId>test</groupId>
<artifactId>my.parent</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
模块Pom:
<parent>
<groupId>test</groupId>
<artifactId>my.parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>my.module</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
设置.xml
<settings>
<mirrors>
<mirror>
<id>Nexus</id>
<url>http://mynexus:8081/repository/maven-group/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<settings
解决方案
据我所知,您可以使用 IDE 或命令行调用 maven。
如果您从 IDE 调用,请检查设置是否映射到您的 settings.xml 文件
如果您使用的是命令行,您可以通过 using 进行检查mvn --v
,它会显示您的 Maven 主页在哪里。然后你可以在下面检查你的设置文件conf/settings.xml
推荐阅读
- prometheus - Prometheus 获取所有指标和描述的列表
- odoo - 当我配置Pycharm时Python解释器无效
- react-native - 如何管理 CocoaPods 中的冲突版本?
- r - RMarkdown 中的自定义结果宽度
- haskell - 遍历将多个映射操作组合成单个 ADT
- c# - C# MVC Html.RenderAction("", "") 返回 Null
- python - 使用 Pandas 转置和创建平面文件
- python - 从零开始的多类 Logistic 回归
- visual-studio-2019 - AspNetZero V8.0 - 调试器立即结束
- python - 将线旋转到负坐标