1.各个仓库介绍
Hosted:宿主仓库
主要放本公司开发的SNAPSHOTS测试版本,RELEASES正式发行版。合作公司第三方的jar包。
Proxy:代理仓库
代理中央仓库;代理Apache下测试版本jar包
Group:组仓库
存放各种仓库(宿主仓库,代理仓库)
Virtual:虚拟仓库(废弃)
代理maven1版本的jar包
2.组仓库可进行配置,存放那个仓库(配置后 通过组仓库即可访问配置过的仓库)
3.maven中私服的配置
jar包上传配置
setting.xml中的配置
<server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server> 项目pom.xml配置 <!-- 分配 --> <distributionManagement> <repository> <id>releases</id> <url>http://localhost:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>snapshots</id> <url>http://localhost:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement>
4.jar包下载配置
setting.xml配置
<server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server> /***************************************************************************/ <mirrors> <mirror> <id>nexus-releases</id> <mirrorOf>*</mirrorOf> <url>http://localhost:8081/nexus/content/groups/public</url> </mirror> <mirror> <id>nexus-snapshots</id> <mirrorOf>*</mirrorOf> <url>http://localhost:8081/nexus/content/groups/public-snapshots</url> </mirror> </mirrors> /***********************************************************************/ <profile> <id>dev</id> <repositories> <repository> <!--仓库id,repositories可以配置多个仓库,保证id不重复--> <id>nexus</id> <!--仓库地址,即nexus仓库组的地址--> <url>http://localhost:8081/nexus/content/groups/public/</url> <!--是否下载releases构件--> <releases> <enabled>true</enabled> </releases> <!--是否下载snapshots构件--> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 --> <pluginRepository> <!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 --> <id>public</id> <name>Public Repositories</name> <url>http://localhost:8081/nexus/content/groups/public/</url> </pluginRepository> </pluginRepositories> </profile> 激活 <activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles>
原文:http://www.cnblogs.com/free-ys/p/6629388.html