搭建Maven私服,并配置Nexus环境

转:

http://wenku.baidu.com/link?url=91i2Ab6TFT85ebHP3ePIQOa1vTrPQ5rWuZCO7EtHhLN8SCwQ9IFs0q8tK7KqfTL7et13HH7LnCQ0bkAq90A-mLwpTkYJcQcLKW7RFV_mjGe

http://blog.csdn.net/shenshen123jun/article/details/9084293

<localRepository>D:\Maven\repository</localRepository>


<servers>  
   <server>
     <id>nexus-releases</id>
     <username>hunan</username>   
     <password>hunan</password> 
    </server>  
   <server>
     <id>nexus-snapshots</id>
     <username>hunan</username> 
     <password>hunan</password>  
   </server>
</servers>



<mirror>
   <id>nexus-mirror</id>
   <url>http://localhost:8081/nexus/content/repositories/central/</url>   
   <mirrorOf>*</mirrorOf>
</mirror>

<profiles>
        <profile>
           <id>nexus-profile</id>   
        <repositories>    
               <repository>
                 <id>nexus-repository</id>
                 <url>http://nexus-mirror</url>
                  <releases><enabled>true</enabled></releases>
                 <snapshots><enabled>true</enabled></snapshots>  
             </repository>   
        </repositories>
   <pluginRepositories> 
        <pluginRepository>
             <id>nexus-plugin-repository</id>   
              <url>http://nexus-mirror</url>
               <releases><enabled>true</enabled></releases>
             <snapshots><enabled>true</enabled></snapshots> 
            </pluginRepository>   
       </pluginRepositories>  
  </profile>
</profiles>
<activeProfiles>
  <activeProfile>nexus-profile</activeProfile> 
</activeProfiles>



如果开发中需要发布jar到Maven私服,提供给其他开发者下载,则需要在pom.xml文件中申明如下:
<distributionManagement>
     <repository>
           <id>nexus-releases</id>
          <name>Nexus Internal Releases Repository</name>
          <url>http://localhost:8081/nexus/content/repositories/releases/</url>
     </repository>
     <snapshotRepository>
          <id>nexus-snapshots</id>
           <name>Nexus Internal Snapshots Repository</name>
          <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>



猜你喜欢

转载自hunan.iteye.com/blog/2243563