美文网首页
Maven 解决RELEASE和SNAPSHOT依赖问题

Maven 解决RELEASE和SNAPSHOT依赖问题

作者: ColinYF | 来源:发表于2016-10-29 10:21 被阅读1999次

    本文适用于,maven和nexus都已经正常配置,但是依赖包只能依赖RELEASE不能依赖SNAPSHOT

         <mirror>            
            <id>Nexus</id>           
           <url>http://192.168.xxx.xxx/content/groups/public/</url>            
           <mirrorOf>*</mirrorOf>    
      </mirror>        
      <mirror>            
             <id>Nexus2</id>            
     <url>http://192.168.xxx.xxx/content/groups/public/</url>           
     <mirrorOf>public-snapshots</mirrorOf> // 对snapshots有效        
    </mirror>
    </mirrors>```
    
    ===========================================(娱乐分割线)
    
    ```   <profiles> //定义public-snapshots profile        
     <profile> 
    <id>public-snapshots</id> 
    <repositories>                
    <repository>                    
    <id>public-snapshots</id>                    
    <url>http://public- snapshots
    </url>                    
    <releases>                        
    <enabled>true</enabled>                    
    </releases>                    
    <snapshots>                       
     <enabled>true</enabled>                   
     </snapshots>                
    </repository>            
    </repositories>            
    <pluginRepositories>                
    <pluginRepository>                    
    <id>public-snapshots</id>                    
    <url>http://public-snapshots</url>                    
    <releases>                        
    <enabled>false</enabled>                    
    </releases>                    
    <snapshots>                        
    <enabled>true</enabled>                    
    </snapshots>                
    </pluginRepository>            
    </pluginRepositories>        
    </profile>    
    </profiles>    ```
    ===========================================(娱乐分割线)
    ```<activeProfiles>        
     <activeProfile>public-snapshots</activeProfile>     
    </activeProfiles>   //使profile生效。  ```
    
    相关指令:```mvn eclipse:eclipse```
    
    ![QQ图片20161101085642.png](https://img.haomeiwen.com/i2501502/df66ddd0d8a452c1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

    相关文章

      网友评论

          本文标题:Maven 解决RELEASE和SNAPSHOT依赖问题

          本文链接:https://www.haomeiwen.com/subject/ntdeuttx.html