【发布时间】:2020-01-02 08:51:39
【问题描述】:
有 2 个 Nexus maven repo - 一个服务或持有普通罐子 - 主要来自 maven Central 和其他一些。以及其他 - 项目特定的 maven nexus,其中包含 2 个第三方 jar,这些 jar 是编译当前感兴趣的项目所必需的。
以下是添加以引用本地 nexus maven 设置和相应依赖项的更新..
pom.xmlsn-p:
<project
...
<!-- download plugins from this *proj specific* repo -->
<repositories>
<repository>
<id>zzz-maven</id>
<name>zzz-maven</name>
<url>http://blah.blah.com/nexus/content/repositories/zzz-maven</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>zzz.zzz-report<groupId>
<artifactId>zzz-report<artifactId>
<version>1.2<version>
</dependency>
...
<!-- And other dependency to fetch jars from common nexus (which is working fine) -->
在下面添加到settings.xml(以粗体文本突出显示) - 一个涵盖用于检索项目特定 jar 的 URL 以及对项目特定 Nexus 进行身份验证的其他部分
<settings>
<mirrors>
<mirror>
<id>nexus</id>
<name>Common nexus across org - Anonymous access </name>
<url>http://common-nexusxyz.com/nexus/content/repositories/maven</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
</profile>
<profile>
<repositories>
<repository>
<id>central</id>
<url>http://central</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>
</pluginRepositories>
</profile>
<!--**Added this one** -->
</profile>
<profile>
<id>zzz-maven</id>
<repositories>
<repository>
<id>zzz-maven</id>
<name>zzz-maven</name>
<url>http://blah.blah.com/nexus/content/repositories/zzz-maven</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
<activeProfile>zzz-maven</activeProfile> <!--**activated** additional one here -->
</activeProfiles>
<servers>
<server>
<id>zzz-maven</id>
<username>userNameForZZZ</username> <!--**Specified** explicit password needed for proj specific maven nexus here -->
<password>passwordForZZZ</password>
</server>
</servers>
</settings>
但仍然会抛出警告,然后是 mvn install 或 mvn compile 的错误,例如:
[WARNING] The POM for zzz.zzz-report:zzz-report:jar:1.2 is missing, no dependency information available
想知道缺少什么 - 以便它可以从项目特定的 maven nexus 下载项目特定的 jar?
尝试在 pom 中同时使用 <repositories> 和 <pluginRepositories> 选项以考虑下载
期望它连接到项目特定的 maven nexus 并下载 pom 中定义的依赖 jar
【问题讨论】:
标签: maven download dependencies settings nexus