我依赖于Nexus实例提供的jar,而不是我们部门的存储库。我们(还)不想更新我们的Nexus镜像其他存储库,也不想更改我们的(共享)settings.xml
所以我将存储库添加到我们的POM中:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company.department</groupId>
<artifactId>simple-sample-app</artifactId>
<packaging>war</packaging>
<version>0.1</version>
<name>simple-sample-app Maven Webapp</name>
<repositories>
<repository>
<id>other-department</id>
<name>other-department.company.com</name>
<url>http://other-department.company.com/content/repositories/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
...
</project>
但是:由于未检查<id>other-department</id>
存储库,mvn构建失败。什么没有正确设置?
编辑:这是我的settings.xml
<settings>
<offline>false</offline>
<proxies>
<proxy>
<active>false</active>
<host>internal-proxy.company.com</host>
<port>8080</port>
<nonProxyHosts>company.com</nonProxyHosts>
</proxy>
</proxies>
<servers>
<server>
<id>releases</id>
<username>deployment</username>
<password>deploy</password>
</server>
<server>
<id>snapshots</id>
<username>deployment</username>
<password>deploy</password>
</server>
<server>
<id>site</id>
<username>sitemanager</username>
<password>sitemanager</password>
</server>
</servers>
<mirrors>
<mirror>
<id>department-nexus-public-snapshots</id>
<url>http://nexus.department.company.com/nexus/content/groups/public-snapshots</url>
<mirrorOf>public-snapshots</mirrorOf>
</mirror>
<mirror>
<id>department-nexus-public</id>
<url>http://nexus.department.company.com/nexus/content/groups/public</url>
<mirrorOf>external:*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>development</id>
<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>
<profile>
<id>public-snapshots</id>
<repositories>
<repository>
<id>public-snapshots</id>
<url>http://public-snapshots</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public-snapshots</id>
<url>http://public-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>development</activeProfile>
<activeProfile>public-snapshots</activeProfile>
</activeProfiles>
</settings>
答案 0 :(得分:1)
感谢Stefan H和@khmarbaise。 问题出在镜像条目中。
我的旧settings.xml包含以下镜像条目:
<settings>
...
<mirrors>
<mirror>
<id>department-nexus-public-snapshots</id>
<url>http://nexus.department.company.com/nexus/content/groups/public-snapshots</url>
<mirrorOf>public-snapshots</mirrorOf>
</mirror>
<mirror>
<id>department-nexus-public</id>
<url>http://nexus.department.company.com/nexus/content/groups/public</url>
<mirrorOf>external:*</mirrorOf>
</mirror>
</mirrors>
...
</settings>
问题在于<mirrorOf>external:*</mirrorOf>
正在加入并有效阻止POM的回购。这是修复:
<settings>
...
<mirrors>
<mirror>
<id>department-nexus-public-snapshots</id>
<url>http://nexus.department.company.com/nexus/content/groups/public-snapshots</url>
<mirrorOf>public-snapshots</mirrorOf>
</mirror>
<mirror>
<id>department-nexus-public</id>
<url>http://nexus.department.company.com/nexus/content/groups/public</url>
<mirrorOf>external:*,!other-department</mirrorOf>
</mirror>
</mirrors>
...
</settings>
现在我们的department-nexus-public
条目不仅用于所有内容:other-department
(来自POM的回购的ID)也可以检查。
现在正在检查我的POM的回购文件。