试了好几天,总算完成了,发现竟然都不是技术上的问题,都是环境上的问题
-------------------------------------------------------------------------------
环境问题:
1. maven的中央库不稳定,经常连接不上去(不知道是本地http代理问题,还确实是中央库的问题)
2. 本地机器太慢,网速太慢
3. nexus连接远端,如果失败,下一次连接时间间隔就会加长,一次间隔比一次间隔长,每次估计要加2分钟左右,这样造成越失败,下一次启动下载时间就越长;
4. nexus要从远端下载index,这个index尺寸比较大,有70M左右(Central库),这样遇到这里机器慢、网速慢的话,下载时间就长,经常认为有问题,就重启了nexus的tomcat,造成永远下载不了。
---------------------------------------------------------------------------------------
重新把过程记录一下:
- 下载nexus的war包(在http://nexus.sonatype.org/downloads/中下载,bundle包在本地运行不了),配置到tomcat中,安装路径为/nexus
- 修改nexus的配置:
在WEB-INF中,文件plexus.properties的nexus-work项,把nexus的数据目录设置成自己要的地方
- 启动tomcat,nexus第一次运行,就按照nexus-work项指定的目录创建目录结构
- 对nexus进行设置
- maven central进行设置:
主要2点:
a).把Remote Repository Access中的Download remote Index项设置成true
b).按照实际环境设置代理
这2点设置完,配置结束
- 配置完,点Save,点了Save数据也不会马上到,要从网上下载70M左右的数据量,原来就是在这里等不起,不断配置,不断重启,造成数据下载中断。
在下载的时候,可以看一下tomcat的log,会有详细的输出。
nexus缺省会把配置的所有Repositiry都进行数据下载,每次下载失败就会加大间隔时间再次下载,如果为了log清楚,可以把其他的Repository都删除,只留下Maven Central这一项就可以了(我没这么做,事后想到的) --- 这一步数据到位花的时间最长;
- 对Public Repository进行设置:
我在Public Repository中,只留了Maven Central这一项,这样可以明确的看到效果:
- 本地maven配置:
修改本地用户的maven setting.xml文件(见附件setting.zip)
按照文档上说的,修改
a). 修改本地目录
<localRepository>D:\zybing\repository</localRepository>
b).本地nexus镜像所有maven站点:
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://127.0.0.1:8080/nexus/content/groups/public</url>
</mirror>
c). 增加Profile: 增加了一个repository,一个pluginRepository,都叫central
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
d). 激活这个Profile:
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
- 本地运行 mvn help:system,把本地仓库建立起来
- 启动Eclipse(已经安装好了m2e了)
Eclipse启动后,如果maven repository配置好了,自动会下载所需要的资源
可以在Progress窗口或者Console maven窗口中看到Eclipse做的事情
当这个工作结束后,就可以工作了
分享到:
相关推荐
自己写的一份关于maven + nexus仓库管理的使用手记 包括了nexus的基本使用及nexus权限管理等
Maven Nexus 私服搭建 从零开始,资源下载、安装指导、开发配置说明
maven nexus 配置,简要介绍如何配置nexus。。。。。。
Maven nexus 安装包
nexus-2.14.5-02-bundle.zip nexus-3.19.1-01-unix.tar.gz nexus-3.19.1-01-win64.zip 包含以上三种安装包,需要可自行下载。
安装自己的maven服务器,解压后进入\nexus-2.1.2-bundle\nexus-2.1.2\bin\jsw\,根据操作系统类型选择文件夹,选择是windows-x86-64文件夹,双击console-nexus.bat运行。游览器中输入http://127.0.0.1:8081/nexus/,...
详细介绍了nexus私服的配置及安装方法
nexus 搭建 maven仓库nexus 搭建 maven仓库nexus 搭建 maven仓库nexus 搭建 maven仓库nexus 搭建 maven仓库
maven私服搭建,nexus,详细讲述搭建过程,包含示例代码
包含了一个父maven项目和及个子项目,可以作为搭建nexus私服的测试代码
maven maven私服 nexus 私服
Maven nexus搭建,配截图,从建立到调用
包含maven+nexus使用文档,pom.xml详解文件,setting.xml详解,maven实战书的部分内容
maven-nexus
Nexus是一个强大的Maven仓库管理器,它极大地简化了自己内部仓库的维护和外部仓库的访问。利用Nexus你可以只在一个地方就能够完全控制访问 和部署在你所维护仓库中的每个Artifact。Nexus是一套“开箱即用”的系统不...
持续集成环境maven+nexus+jenkins+svn搭建
该文档是关于配置maven私服nexus,对maven学习者有很大的帮助
直接解压,并请搜索搭建资料,比如百度:maven nexus 私服搭建