2012-04-10 2 views
2

私は非常に遅い中央リポジトリをプロキシにネクサスを使用しようとしています。 だから。私はチュートリアルに従ってmavenを設定しました。proxingにnexusを使用しているときにpomにカスタムリポジトリを追加するにはどうすればいいですか?

<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に指定されたカスタムリポジトリを使用しようとしたときに問題に直面しました(このレポは具体的なプロジェクトにのみ必要です)

So.

<mirrorOf>*</mirrorOf> 

へ:

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で、私は次の行を変更しました:エラーメッセージ

https://github.com/dtrott/maven-protoc-plugin#readme

:から

<pluginRepositories> 
    <pluginRepository> 
    <id>dtrott</id> 
    <url>http://maven.davidtrott.com/repository</url> 
    </pluginRepository> 
</pluginRepositories> 

:私は話しています

<mirrorOf>central</mirrorOf> 

、それは今働いている...

+0

大きな感謝!私はあなたの質問/答えを見つけるまで、これを理解しようと15分間過ごしました。 –

答えて

2

1つのオプションは、プロキシリポジトリ(タイプproxy)としてあなたNexusにカスタムリポジトリを追加することです。その後、あなたのpomに何かを追加する必要はありません。

+0

私はこれをやろうとしました...しかし、残念なことにnexusはこの 'dtrott'リポジトリからインデックスをダウンロードしたくない... – denys

+0

S3リポジトリ... https://issues.sonatype.orgを見てください/ browse/NEXUS-1121およびhttp://stackoverflow.com/questions/2625553/how-can-i-get-nexus-to-proxy-springsource-maven-repository-on-s3 – Anonymous

+1

そのプロキシリポジトリがインデックスを持っていれば、そこからの成果物にアクセスするためにはまだ動作します。それは検索に表示されません。しかし、リモートリポジトリをブラウズして、そこにあるものを探します。 –

関連する問題