Maven 解决RELEASE和SNAPSHOT依赖问题

本文适用于,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](http://upload-images.jianshu.io/upload_images/2501502-df66ddd0d8a452c1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,868评论 18 139
  • 搭建 nexus 私服(centos6.7) 备注:Centos 6.7 、 nexus-2.12.1-01-bu...
    逐暗者阅读 2,524评论 3 9
  • 一、Nexus安装 1、安装方式一 使用nexus-builder.yaml文件进行安装: 安装完成后,查找对应端...
    SetZero阅读 3,277评论 1 2
  • |-1-更新内容[6.从仓库解析依赖的机制(重要)] 1Maven仓库作用 仓库用来存储所有项目使用到构件,在ma...
    zlcook阅读 6,125评论 0 25
  • 首先私服是一种衍生出来的特殊的Maven远程仓库,构建私服的好处请看3.5私服 可以帮助大家建立私服的仓库管理软件...
    zlcook阅读 10,606评论 0 32