2012-09-04 14 views
12

मैं नेक्सस का उपयोग कर कंपनी स्थानीय मैवेन रिपोजिटरी बनाना चाहता हूं। रिपोजिटरी को सार्वजनिक इंटरनेट से कुछ भी डाउनलोड नहीं करना चाहिए, सबकुछ रेपो में जोड़ा जाता है। डेवलपर के स्थानीय मैवेन इंस्टेंसियों को कंपनी नेक्सस से आवश्यक पुस्तकालयों और औजारों को डाउनलोड करना चाहिए। मैं 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> 

समस्या है कि मैं केवल विज्ञप्ति भंडार को इंगित करने में सक्षम हूँ, मैं खोज करने के लिए तीसरे पक्ष और स्नैपशॉट भंडार शामिल करना चाहते हैं भी। क्या किसी को कोई विचार है कि यह कैसे किया जाना चाहिए? मिरर टैग केवल एक यूआरएल लेता है।

मैं भी इस तरह डिफ़ॉल्ट प्रोफ़ाइल परिभाषित करने के साथ करने की कोशिश की: कि समाधान के साथ

<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> 

समस्या यह है कि यह अभी भी repo.maven.apache.org से डाउनलोड करता है, तो Maven उन खजाने से कुछ भी नहीं मिलता है है। किसी भी तरह की सहायता का स्वागत है। धन्यवाद!

उत्तर

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 मैं यही करने की कोशिश कर रहा हूं: नेक्सस रेपो समूह के साथ केंद्रीय मिरर करें, और इसके ऊपर अतिरिक्त रेपोज़ जोड़ें –

+0

इसे हल करने के लिए इसे Nexus में कॉन्फ़िगर किया जाना चाहिए और settings.xml में कॉन्फ़िगर नहीं किया जाना चाहिए। – khmarbaise

संबंधित मुद्दे