这种配置也是可以的。它工作得很好,但是有一个艰难的情况,如果项目层次结构很大并且并非所有孩子都有相同的父母,那么你甚至必须将这部分复制到他们的 pom 中。这意味着除了在项目中声明这个假中心的项目之外的任何地方,即要查看的默认存储库,您的请求将转到适当的 maven 中心或项目的 pom.xml 中的其他声明的存储库。CATCH:您使用插件 X——也许实际上并没有意识到它——并且插件 X 依赖于工件 Y,它在它自己的 pom 中声明了 repo.... >>> 无法控制代理所有对依赖项的请求关系
另一种选择是为项目提供额外的 settings.xml 并“提供”它 $mvn -s settings.xml
第三种选择是全局 settings.xml 如下所示,并且仅在需要时激活 -P nexus,因为如果没有伪造的中央存储库,它会令人惊讶地工作。
<settings>
<mirrors>
<mirror>
<id>nexus</id>
<name>nexus</name>
<url>http://localhost:8082/nexus-webapp-1.6.0/content/groups/public</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
</activeProfiles>
</settings>
在另一个选项卡/窗口中打开图像。
