我正在尝试使用 Nexus 来代理中央存储库,但速度相当慢。 所以。我已经根据教程配置了maven。
<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<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>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
一切都运行良好且快速。但是当我尝试使用 pom.xml 中指定的自定义存储库时,我遇到了问题(仅具体项目需要此存储库)
所以。我说的是:
<pluginRepositories>
<pluginRepository>
<id>dtrott</id>
<url>http://maven.davidtrott.com/repository</url>
</pluginRepository>
</pluginRepositories>
来自:https://github.com/dtrott/maven-protoc-plugin#readme
错误消息:
Error resolving version for plugin 'com.google.protobuf.tools:maven-protoc-plugin' from the repositories [local (C:\Users\valden\.m2\repository), nexus (http://localhost:8081/nexus/content/groups/public)]: Plugin not found in any plugin repository -> [Help 1]
在 Maven settings.xml 中,我更改了下一行:
<mirrorOf>*</mirrorOf>
到
<mirrorOf>central</mirrorOf>
现在正在工作......
最佳答案
一种选择是将自定义存储库作为代理存储库(类型 proxy
)添加到您的 Nexus
中。那么您就不必在您的 pom
中添加任何额外的内容。
关于java - 当我使用 Nexus 进行代理时,如何在 pom 中添加自定义存储库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10085754/