2010-02-25 3 views
4

어제는 엄청나게 많은 메이븐 저장소를 사용해 보았습니다. 이제는 2를 사용해야합니다. 둘 다 개인용입니다. 그래서 this link은 하나의 저장소를 사용하도록 maven에 대해 설명합니다. 두 번째 저장소? 예를 들어 pom.xml에이 저장소 중 두 개가 있습니다. 두 저장소에 누락 된 것이 있으면 공개 저장소에 대한 종속성을 검색합니다.이를 방지하려면 어떻게해야합니까?여러 기업 리포지토리 사용하기

<repositories> 
    <repository> 
     <id>my-internal-site</id> 
     <name>our maven repository</name> 
     <url>http://myserver/repo</url> 
    </repository> 
<repository> 
     <id>my-other-internal-site</id> 
     <name>our 2nd maven repository</name> 
     <url>http://myserver/repo2</url> 
    </repository> 
    </repositories> 

나는이 같은 설정 XML을 변경해야겠습니까?

<settings> 
    ... 
    <mirrors> 
    <mirror> 
     <id>internal-repository</id> 
     <name>our maven repository</name> 
     <url>http://myserver/repo</url> 
     <mirrorOf>my-internal-site,my-other-internal-site</mirrorOf> 
    </mirror> 
    <mirror> 
     <id>my-other-internal-site</id> 
     <name>our 2nd maven repository</name> 
     <url>http://myserver/repo2</url> 
     <mirrorOf>my-internal-site,my-other-internal-site</mirrorOf> 
    </mirror> 
    </mirrors> 
    ... 
</settings> 

또는 다른 방법으로?

편집

난 내가 Settings.XML의 독점 사람을 지정할 경우 누군가가 답변을 할 수 있습니다 .. 난 그냥 포인트를 만들고있어 내 pom.xml 파일에 저장소를 설정할 필요가 없습니다 알아 내

<settings> 
    ... 
    <mirrors> 
    <mirror> 
     <id>internal-repository</id> 
     <name>Maven Repository Manager running on repo.mycompany.com</name> 
     <url>http://repo.mycompany.com/proxy</url> 
     <mirrorOf>*</mirrorOf> 
    </mirror> 
    </mirrors> 
    ... 
</settings> 

을 그리고 "프록시 저장소"로 다른 내부 저장소를 추가 (대부분의 저장소 관리자 프록시 할 수 저장소) 처음에 .. 질문 더 나은 당신이

답변

4

- 당신이 설명 된 구성은 하나의 거울에 영향을 미치지 않을 것이다 주어 mirrorOf으로 선택된다.

거울 주어진 ID 또는 ID들의 컬렉션 (external:* 등) 중 이미 정의 된 저장소를 교체한다. 저장소를 추가해야하는 경우 POM 또는 설정에서 저장소 요소를 추가해야합니다.

<settings> 
    ... 
    <profiles> 
    <profile> 
     <id>second-repo</id> 
     <repositories> 
     <repository> 
      <id>second-repo</id> 
      <url>http://myrepo/second-repo</url> 
      <!-- add releases/snapshots config as appropriate here --> 
     </repository> 
     </repositories> 
     <!-- duplicate for pluginRepositories here if needed --> 
    </profile> 
    </profiles> 
    <activeProfiles> 
    <activeProfile>second-repo</activeProfile> 
    </activeProfiles> 
    ... 
    <mirrors> 
    <mirror> 
     <id>corporate-repo</id> 
     <url>http://myrepo/my-group</url> 
     <mirrorOf>external:*,!second-repo</mirrorOf> 
    </mirror> 
    </mirrors> 
    ... 
</settings> 
+0

아 물론! –

2

난 아직도 사용하십시오 감사합니다. 당신이해야 할 이유

는하지만 궁금하다. 모든 프로젝트가 동일한 내부 저장소를 사용할 수 있습니까? 당신은 거울에있는 저장소를 복제 할 필요가 없습니다

+0

@Pascal Thivent'그러나 당신이이 일을 왜 궁금해 :

당신은 아마 이런 식으로 뭔가를 할 수 있습니다. 모든 프로젝트가 동일한 내부 리포지토리를 사용할 수는 없습니까? "라고 묻습니다. 나에게 묻는다면 아무도 할 수는 없지만 DI는 업데이트하는 방법을 얻습니다. 프록시 리포지토리에 대한 자세한 내용은 어디서 볼 수 있습니까? 'togle 아무것도 유용한 지금까지 .. 내가 GUI를 사용하는 대신 POM이나 설정에서 프록시 저장소를 추가 할 수 있습니까? – ant

+0

@ c0mrade Nexus 설명서에 대한 링크를 추가했습니다 (귀하는 Nexus를 사용하고 있습니까?). 어쩌면 명확하지 않지만 순수 Nexus 설정, 즉 순수 Nexus 설정, POM 또는 설정 수준에서 수행 할 수 없습니다 (적어도 내가 제안하는 것은 아닙니다). –

+0

더 우리가 Artifactory (http://www.jfrog.org/products.php)를 사용하고, 내가 저장소에서 읽기를 제외하고 권한이없는, 다른 사람은 내가 성공에 대한 책임을 해요 .. 지금은 빌드를하지 않습니다. . 내가 이해 한 것처럼 ... 나는 2 개의 레포지토리에 대한 참조를 만들고 settings.xml의 mirrorOf에 id를 쉼표로 구분하여 추가해야한다. – ant