2012-09-04 3 views
12

ネクサスを使用して会社のローカルMavenリポジトリを作成したいと思います。リポジトリは公共のインターネットから何もダウンロードしてはならず、必要なものすべてがリポジトリに追加されます。開発者のローカルマーケットは、必要なライブラリやツールを会社のネクサスからダウンロードする必要があります。私はsettings.xml内のこのようミラーを使用することにより、これを行うために管理している:このソリューションで会社ローカルネクサスリポジトリのみを使用する方法

<mirror> 
    <id>company-repository</id> 
    <name>Company releases repository</name> 
    <url>http://nexus.company.com/nexus/content/repositories/releases</url> 
    <mirrorOf>*</mirrorOf> 
</mirror> 

問題は、私は唯一のリリースリポジトリを指すことが可能だということですが、私は検索するサードパーティおよびスナップショットリポジトリを含めたいです同じように。どのようにすればよいか誰にも考えられていますか?ミラータグにはURLが1つしかありません。

は、私はまた、次のようにデフォルトのプロファイルを定義してみました。そのソリューションと

<profile>    
    <id>defaultProfile</id> 
    <activation> 
     <activeByDefault>true</activeByDefault> 
    </activation> 
    <repositories> 
     <repository> 
      <id>company-thirdparty-repo</id> 
      <url>http://nexus.company.com//nexus/content/repositories/thirdparty</url> 
      <releases> 
       <checksumPolicy>fail</checksumPolicy> 
      </releases> 
      <snapshots> 
       <enabled>false</enabled> 
      </snapshots> 
     </repository> 
     <repository> 
      <id>company-releases-repo</id> 
      <url>http://nexus.company.com/nexus/content/repositories/releases</url> 
      <snapshots> 
       <enabled>true</enabled> 
       <updatePolicy>always</updatePolicy> 
       <checksumPolicy>fail</checksumPolicy> 
      </snapshots> 
      <releases> 
       <enabled>true</enabled> 
       <checksumPolicy>fail</checksumPolicy> 
      </releases> 
     </repository> 
    </repositories> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>central</id> 
      <url>http://nexus.company.com/nexus/content/repositories/central</url> 
      <releases> 
       <enabled>true</enabled> 
       <checksumPolicy>fail</checksumPolicy> 
      </releases> 
      <snapshots> 
       <checksumPolicy>fail</checksumPolicy> 
      </snapshots> 
     </pluginRepository> 
    </pluginRepositories>    
</profile> 

問題は、Mavenのは、これらのリポジトリから何かを見つけていない場合、それはまだrepo.maven.apache.orgから、それをダウンロードすることです。私はどんな助けにも感謝します。ありがとう!

答えて

5

あなたは両方の組み合わせを使用することができます。

がリモート公共レポのプロキシのためのリポジトリのグループを作成します(あなたが公共のそれを呼び出すと仮定)。 、他のリポジトリの

「中央」であるMavenの、唯一のデフォルトのリポジトリをミラーするためにこれを使用し、単にリポジトリ/プラグインのレポとして追加のsettings.xmlは、次のようになります

<settings> 
    <mirrors> 
     <mirror> 
      <id>nexus</id> 
      <mirrorOf>central</mirrorOf> 
      <url>http://your/nexus/groups/public</url> 
     </mirror> 
    </mirrors> 

    <profiles> 
     <profile> 
      <id>nexus</id> 
      <repositories> 
       <repository> 
        <!-- for you to override settings of central --> 
        <id>central</id> 
        <url>http://a.fake.host</url> 
        <releases><enabled>true</enabled></releases> 
        <snapshots><enabled>true</enabled></snapshots> 
       </repository> 
       <repository> 
        <id>anotherRepo</id> 
        <url>http://your/nexus/groups/anotherRepo</url> 
        <releases><enabled>true</enabled></releases> 
        <snapshots><enabled>true</enabled></snapshots> 
       </repository> 

      </repositories> 
      <pluginRepositories> 
       <pluginRepository> 
        <!-- for you to override settings of central --> 
        <id>central</id> 
        <url>http://a.fake.host</url> 
        <releases><enabled>true</enabled></releases> 
        <snapshots><enabled>true</enabled></snapshots> 
       </pluginRepository> 

       <pluginRepository> 
        <id>anotherRepo</id> 
        <url>http://your/nexus/groups/anotherRepo</url> 
        <releases><enabled>true</enabled></releases> 
        <snapshots><enabled>true</enabled></snapshots> 
       </pluginRepository> 
      </pluginRepositories> 
     </profile> 
    </profiles> 

    <activeProfiles> 
     <activeProfile>nexus</activeProfile> 
    </activeProfiles> 
</settings> 
+0

タグでは、「*」と答える必要があります。そうでなければセントラルだけがミラーリングされます(ここを見てください:http://www.sonatype.com/books/nexus-book/reference/maven-sect-single-group.html )。 – khmarbaise

+0

@khmarbaiseそれは私がやろうとしていることです:ネクサスのリポジトリグループを中心にミラーリングし、その上に追加のreposを追加してください –

+0

これを解決するには、Nexusで設定し、settings.xmlで設定しないでください。 – khmarbaise

関連する問題