我依赖于不是我们部门存储库的 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>
但是:由于未检查存储库,因此 mvn 构建失败<id>other-department</id>
。什么设置不正确?
编辑:这是我的 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>