Maven 사복 에서 의존 획득

3041 단어 Maven 사복
다음으로 이동:http://blog.csdn.net/sheismylife/article/details/7209722
인터넷 을 통 해 Maven 공용 창고 에서 의존 패 키 지 를 직접 가 져 오 는 것 은 기본 설정 입 니 다.그러나 중국 소프트웨어 회사 에 있어 이런 공공 창 고 를 방문 하 는 것 은 비교적 느 리 고 관리 가 엄격 하여 직접 인터넷 에 접속 할 수 없 는 소프트웨어 회사 에 있어 이것 은 더욱 불가능 하 다.Maven 프로젝트 는 Maven 사복 에서 만 의존 을 얻 을 수 있 도록 설정 할 수 있 습 니 다.
지난 편 에 서 는 넥 서 스 를 Maven 사복 으로 설치 하 는 방법 을 다 뤘 다.다음은 S1 서버 의 Nexus 서 비 스 를 사용한다 고 가정 합 니 다.공식 문 서 를 참고 할 수 있 습 니 다.
http://www.sonatype.com/books/nexus-book/reference/config-sect-intro.html
개발 기계 에 Maven 프로젝트 가 있 습 니 다. 먼저 편집 ~ / m2 / settings. xml.
<settings>  
  <mirrors>  
    <mirror>  
      <!--This sends everything else to /public -->  
      <id>nexus</id>  
      <mirrorOf>*</mirrorOf>  
      <url>http://S1: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>  
      </pluginRepositories>  
    </profile>  
  </profiles>  
  <activeProfiles>  
    <!--make the profile active all the time -->  
    <activeProfile>nexus</activeProfile>  
  </activeProfiles>  
</settings>  
 S1 을 자신의 넥 서 스 서버 주소 로 바 꾸 기만 하면 됩 니 다.Maven 프로젝트 의 pom. xml 에 사용자 정의 reposcory 가 없다 면 사용 할 수 있 습 니 다.예 를 들 어 mvn clean copile 명령 을 실행 하면 S1 에서 pom. xml 와 jar 패 키 지 를 다운로드 할 수 있 습 니 다.
 
때때로 nexus 에 최신 snapshot 이 배치 되 어 있 지만, mvn clean copile 은 최신 버 전 을 가 져 오지 않 습 니 다. 이 때 는 - U 매개 변수 로 강제 검 사 를 해 야 합 니 다.
mvn clean compile -U
아직 안 되면 로 컬 캐 시 디 렉 터 리 를 삭제 합 니 다. jenkins 프로젝트 에서 build 전에 명령 을 실행 할 수 있 습 니 다. 예 를 들 어:
rm -rf /usr/share/tomcat7/.m2/repository/com/esri/carrier/nginx-factory/  

좋은 웹페이지 즐겨찾기