我正在尝试使用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中指定的自定义存储库时,我遇到了问题(仅对具体项目需要此repo)
因此。我在说:
<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>
现在正在运作......
答案 0 :(得分:2)
一种选择是将自定义存储库作为代理存储库(类型Nexus
)添加到proxy
。那么您不必在pom
中添加任何额外内容。