2

我正在尝试使用 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>  

它现在正在工作......

4

1 回答 1

2

一种选择是将自定义存储库Nexus作为代理存储库(类型proxy)添加到您的。然后你不必在你的pom.

于 2012-04-10T08:59:05.887 回答