搭建maven私服,解决速度问题。
我使用了一个破解的版本,遇到的小问题。
1、索引问题
开始以为不可用,就update index,等了好久发现下载了,但是还是不可以使用。
配置{M2_HOME}/setting.xml,或者修改~/.m2/settings.xml.后者优先级大于前者,pom.xml的优先级最高了。
<profile> <id>nexus</id> <repositories> <repository> <id>nexus</id> <name>local private nexus</name> <url>http://localhost:8081/nexus/content/groups/public</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>false</enabled></snapshots> </repository> <repository> <id>nexus</id> <name>local private nexus</name> <url>http://localhost:8081/nexus/content/groups/public-snapshots</url> <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus</id> <name>local private nexus</name> <url>http://localhost:8081/nexus/content/groups/public</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>false</enabled></snapshots> </pluginRepository> <pluginRepository> <id>nexus</id> <name>local private nexus</name> <url>http://localhost:8081/nexus/content/groups/public-snapshots</url> <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile>
修改activeProfiles为:
<activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles>
5. 为nexus增加Artifact
有些特殊的Artifact无法从maven官网仓库中下载,比如sun的一些包,只好自己自行下载后添加到私服中。
在nexus中我选择将这些Artifact上传到默认安装就存在的仓库3rd Party中,右击仓库名,选择Upload Artifact。
6. 在eclipse中使用索引功能
原来试过,使用artifactory私服也可以使用Artifact的索引功能,但是由于不知道怎么设置远程仓库的index,我只会设置
当前artifactory私服已有的Artifact的索引,对于还没有导入到artifactory私服的Artifact就没有办法索引了,很不方便,
毕竟刚开始使用maven时,所有用到的Artifact都是本地和私服没有而需要到远程仓库取的。
nexus中可以很方便的得到远程仓库的Artifact的索引,在上面“3. 配置nexus”就介绍过。下面介绍如何在eclispe里面
设置和使用索引功能:
1) 打开Maven Indexes 的eclispe view
在eclispe中选择window -> show view -> other ... -> Maven -> Maven Indexes
2) 添加nexus的index
右键菜单中选"add index", 在弹出的"Add Respository index"窗口中填入:
Repository URL: http://localhost:8081/nexus/content/groups/public
Repository Id: nexus
Index Update URL: 放空,暂时还不知道该怎么填
加入后eclispe会自动load一次index信息,然后就可以在新加入的index下可以拉出极大数量的Artifact信息。
3) 测试一下使用
找个pom.xml文件,右键 -> Add Dependency, 然后填入一个关键词,比如我填入mina,马上填出和mina相关的一些
选择,我找到apache mina,双击最新一个版本。会自动在pom.xml文件中增加以下内容:
<groupId>org.apache.directory.mina</groupId>
<artifactId>mina-core</artifactId>
<version>0.9.5</version>
</dependency>
然后Maven自动下载jar包,再将jar包加入项目的build path,全程自动化处理,真是爽啊。
7. 为nexus增加新的proxy repository
方法很简单,administration -> Repositories -> add -> proxy,填写后保存即可。但是要注意,nexus不会自动将新加入的repository添加到group中,而我们一般喜欢直接使用默认的"public repository" group, 比如前面我在maven的profile中就只设置了这一个URL: http://localhost:8081/nexus/content/groups/public。因此需要手工修改"public repository" group的设置,将刚才添加的proxy repository加到组中。
推荐的repository有:
1) jboss http://repository.jboss.com/maven2/
2) sun http://download.java.net/maven/2/
3)k-int http://developer.k-int.com/maven2/
加入这个纯粹是因为它有sun的jmxri/jmxtools这些Artifact,强烈鄙视sun,自己的官方repository居然没有。
4)sonatype http://repository.sonatype.org/content/groups/public/
8. 总结
很明显,nexus无论是在界面,功能,操作上,都比artifactory强大的多。
因此推荐大家使用nexus替代artifactory作为maven私服。
updates:
1. 2008.11.28
由于公司升级操作系统,告别老旧不堪的windows2000升级到vista,因此重新安装了nexus. 新版本的nexus似乎增加了不少小的功能比如对remote index的支持,具体没有深究,不过能不断更新实在是很令人欣慰。以后就打算用nexus了。
2. 2009.10.15
一年来陆续发现了一些比较不错的maven仓库
1) fedora.is
http://fedora.is/maven/
2) ibiblio
http://mirrors.ibiblio.org/pub/mirrors/maven2/
这个是ivy的官网,东西比较多
3) rothamsted
http://ondex.rothamsted.bbsrc.ac.uk/nexus/content/repositories/releases/
http://ondex.rothamsted.bbsrc.ac.uk/nexus/content/repositories/wso2/
有一些比较偏门的东西
相关推荐
自己写的一份关于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仓库
NULL 博文链接:https://zybing.iteye.com/blog/1167288
maven私服搭建,nexus,详细讲述搭建过程,包含示例代码
包含了一个父maven项目和及个子项目,可以作为搭建nexus私服的测试代码
maven maven私服 nexus 私服
Nexus是一个强大的Maven仓库管理器,它极大地简化了自己内部仓库的维护和外部仓库的访问。利用Nexus你可以只在一个地方就能够完全控制访问 和部署在你所维护仓库中的每个Artifact。Nexus是一套“开箱即用”的系统不...
Maven nexus搭建,配截图,从建立到调用
包含maven+nexus使用文档,pom.xml详解文件,setting.xml详解,maven实战书的部分内容
maven-nexus
持续集成环境maven+nexus+jenkins+svn搭建
该文档是关于配置maven私服nexus,对maven学习者有很大的帮助
直接解压,并请搜索搭建资料,比如百度:maven nexus 私服搭建