centos搭建maven私服

来源:互联网 发布:手机常用的网络制式 编辑:程序博客网 时间:2024/06/03 23:42

1、下载nexus

地址:

http://www.sonatype.com/download-oss-sonatype(话说已经不能下载了,只能去csdn上找找)

nexus-2.5.X及之前版本支持jdk1.6
nexus-3.0.X需要jdk1.8
本次使用的是nexus-2.5.1版本

2、安装nexus 解压nexus至/usr/local/nexus目录 解压出两个文件夹: nexus-2.5.1-01  nexus程序目录 sonatype-work   下载的jar文件

3、运行nexus 执行/usr/local/nexus/nexus-2.5.1/bin/nexus start命令启动nexus

4、配置nexus

(1)nexus默认端口为8081,如启动后外部无法访问,需要在iptables中开启8081端口

vim /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT service iptables restart 

(2)nexus默认用户名admin,默认密码admin123

(3)仓库类型详解

hosted   类型的仓库,内部项目的发布仓库

releases 内部的模块中release模块的发布仓库

snapshots 发布内部的SNAPSHOT模块的仓库

3rd party 第三方依赖的仓库,这个数据通常是由内部人员自行下载之后发布上去

proxy   类型的仓库,从远程中央仓库中寻找数据的仓库

group   类型的仓库,组仓库用来方便我们开发人员进行设置的仓库

(3)开启中央仓库的nexus索引 点中Central仓库,

Configuration中Download Remote Indexes修改为True 点击save按钮

5、开发机配置  

maven目录下conf/settings.xml,将<profiles></profiles>中增加     


<profile>       <id>dev</id>          <repositories>             <repository>                 <id>nexus</id>                 <url>http://192.168.0.59:8081/nexus/content/groups/public/</url>                 <releases>                    <enabled>true</enabled>                 </releases>                 <snapshots>                    <enabled>true</enabled>                 </snapshots>              </repository>            </repositories>                        <pluginRepositories>                <pluginRepository>                    <id>nexus</id>                    <url>http://192.168.0.59:8081/nexus/content/groups/public/</url>                    <releases>                        <enabled>true</enabled>                    </releases>                    <snapshots>                        <enabled>true</enabled>                   </snapshots>                </pluginRepository>            </pluginRepositories>        </profile>

最后加入dev引用   

<activeProfiles>             <activeProfile>dev</activeProfile>     </activeProfiles>     

参考资料

http://blog.csdn.net/shenshen123jun/article/details/9084293

http://www.cnblogs.com/quanyongan/archive/2013/04/24/3037589.html

http://www.blogjava.net/baoyaer/articles/355040.html     


0 0
原创粉丝点击