Nexus2+搭建Maven私服
简言:
Nexus是Maven仓库管理器,目的是搭建一个本地仓库服务器,其实就是在公司局域网中设置一个可以供内部下载到maven 数据的服务器,这样的好处是节省网络资源,速度快,可以通过nexus对项目的零时版本管理,来进行模块间的依赖开发,也可以自己发布一些资源来共享。
1.安装
1.1 下载
从https://www.sonatype.com/download-oss-sonatype下载Nexus Repository Manager OSS 2.x;下载完成后解压文件;

1.2 配置
打开配置文件 nexus-2.14.4-03\conf\nexus.properties

根据需要修改配置文件;
1 # 2 # Sonatype Nexus (TM) Open Source Version 3 # Copyright (c) 2008-present Sonatype, Inc. 4 # All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions. 5 # 6 # This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0, 7 # which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html. 8 # 9 # Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks 10 # of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the 11 # Eclipse Foundation. All other trademarks are the property of their respective owners. 12 # 13 14 # Sonatype Nexus 15 # ============== 16 # This is the most basic configuration of Nexus. 17 18 # Jetty section 19 application-port=8081#应用的端口 20 application-host=192.168.2.25#访问地址IP 21 nexus-webapp=${bundleBasedir}/nexus#项目本地路径 22 nexus-webapp-context-path=/nexus#项目访问名称 23 24 # Nexus section 25 nexus-work=${bundleBasedir}/../sonatype-work/nexus 26 runtime=${bundleBasedir}/nexus/WEB-INF 27 28 # orientdb buffer size in megabytes 29 storage.diskCache.bufferSize=4096
1.3运行nexus
1.3.1 将nexus注册成windows服务;
启动cmd 进入\nexus-2.14.4-03\bin目录,执行nexus.bat install命令;

此时系统服务中就会出现nexus服务,启动服务(java虚拟机必须1.7及以上版本);

访问 http://172.16.2.25:8181/nexus/ 并登录 初始用户名密码:admin admin123;
将中央仓库的Download Remote Indexes 设置为true;

2.maven setting配置
修改maven setting文件
1 <mirror> 2 <id>public</id> 3 <mirrorOf>*</mirrorOf> 4 <name>Human Readable Name for this Mirror.</name> 5 <url>http://172.16.2.25:8181/nexus/content/groups/public/</url> 6 </mirror>
生于忧患,死于安乐

浙公网安备 33010602011771号