1、下载Nexus安装文件:http://www.sonatype.org/nexus/go ,目前是nexus-2.13.0-01-bundle.tar.zip这个最新版本;

2、解压到任意目录,我这里解压到E盘,进入F:\nexus-2.13.0-01\bin\jsw\windows-x86-64,点击install-nexus.bat安装成为windows服务,这里选择自己计算机对应的文件;

3、访问http://localhost:8081/nexus/,这就是私服;默认用户名admin 默认密码admin123

5、点击左边Repositories,可以看到一系列仓库类型,我们一般使用3个,分别是Releases,Snapshots和3rd party。这3个仓库风别是装稳定版,开发版和第三方jar包 。

6、举例,手动上传一个jar到Releases仓库里面。

 

  7、上面是手动方式,另外一种是利用mvn直接发布到私服上面来,需要修改2个地方,第一是在settings文件的servers节点下加入,这是配置私服的密码和仓库,配合pom文件中的仓库地址就构成了完成的访问私服的要素,帐号和密码之所以在settings中设置,是由于settings文件是本地的,而pom.xml文件是公共的,不安全,所以放在settings中:

<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server> <server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>

  第二是在pom.xml中增加,下面的id和settings中的id必须要一样。

    <distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>

  上面的私服两个仓库的url从什么地方获取呢?如下图:

  

  8、新建一个mvn项目,

    1、运行source:jar在target下生成源码jar包;

    2、运行deploy,class的jar包发布到私服;

    3、运行source:jar deploy,连同源码一起发布到私服。

  9、完成,在其他项目中可以使用上面的jar包了。

  10、a.贴两个以前遇到过的小异常过来,在eclipse中配置mvn的时候可以分别配置mvn的目录和settings文件,不过最好是二者是同一个版本的,不然有可能就会出问题。

     b.我们有时候明明<dependency>没写错,却偏偏各种报错,可以删掉本地对应的jar,重新下载,就ok了。

  11、学习建议:mvn这个东西,就是难者不会,会者不难。基本上按照这样一个路线就问题不大,基本使用 => 了解继承/聚合 => 了解jar包冲突机制,并解决冲突 =>了解mvn的3个默认声明周期 ,生命周期的各个阶段phase ,各个阶段的目标goal => mvn的插件开发 => Nexus私服搭建及其使用。大致这样一个过程下来,就能非常熟悉mvn,如果在稍微看看mvn的源码,大致看一看,基本上可以说是精通mvn了。

Nexus Maven 私服搭建的更多相关文章

  1. nexus maven私服搭建

    1.在服务器上安装jdk 2.下载 nexus-3.14.0-04-unix.tar.gz,并上传到服务器/opt目录 3.解压 tar -zxvf nexus-3.14.0-04-unix.tar. ...

  2. window Maven私服搭建——nexus

    注:本文来源于 <window   Maven私服搭建--nexus> Maven私服搭建--nexus 1.下载nexus https://www.sonatype.com/downlo ...

  3. maven私服搭建

    一.软件安装 地址:http://www.sonatype.org/nexus/thank-you-for-downloading/?dl=tgz 解压: 启动: >> nexus sta ...

  4. maven私服搭建(centOS6.5)

    maven的好处和私服的应用本文不赘述,私服搭建如下: MAVEN 私服搭建(centOS 6.5 环境) 1.  准备环境,搭建centOS6.5系统环境,略 2.  准备对应的软件包如下: A. ...

  5. maven仓库总结,maven私服搭建

    配置pom.xml依赖包时在这里找包的描述: http://search.maven.org/#browse 以java为根目录. mvn archtype:generate -DgroupId=zt ...

  6. maven仓库总结,maven私服搭建,批量mvn eclipse:eclipse

    配置pom.xml依赖包时在这里找包的描述: http://search.maven.org/#browse 以java为根目录. mvn archtype:generate -DgroupId=zt ...

  7. maven私服搭建&使用

    Maven私服搭建教程 一.nexus安装 1,解压安装包 安装包下载地址 2,以管理员身份打开cmd 3,进入到nexus的bin目录 (1) 安装:nexus install (2) 启动:nex ...

  8. centos7搭建nexus maven私服

    前置条件: 1.安装jdk,可参考 http://www.cnblogs.com/grey-wolf/p/6480489.html 2.nexus仓库管理器,分为两个版本,Nexus Reposito ...

  9. Linux 下搭建 Sonatype Nexus Maven 私服

    一.为什么需要搭建mave私服 如果没有私服,我们所需的所有构件都需要通过maven的中央仓库和第三方的Maven仓库下载到本地,而一个团队中的所有人都重复的从maven仓库下 载构件无疑加大了仓库的 ...

随机推荐

  1. Remote小Demo

    Demo基于http://www.cnblogs.com/zhili/p/NETRemoting.html RemotingObj using System; using System.Collect ...

  2. Digi. Certificates: Key pairs usages

    In short, we have some sort of algorithms to gen pair of private and public keys. The public key is ...

  3. Managed Switch: Confs

    shortcuts: c-w: delete word before c-a: move to first char c-y: delete everything after cursor c-z: ...

  4. gridview XML

    GridView动态添加模板列   http://blog.csdn.net/wljhk2006/article/details/24723219 XML与DataTable互转类 http://bl ...

  5. Java. Warning – Build path specifies execution environment J2SE-1.5

    Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace th ...

  6. ios9 新关键字 __kindof 等(etc) 小结

    首先__kindof:规定参数为UITableViewCell(举例)这个类或者其子类.比如说一个NSArray<UIView *>*,如果不加__kindof,这个数组只能有UIView ...

  7. Winform制作圆弧panel

    原理就是手动去画边框留出四个角 然后绘制四张圆弧的图片到panel上 public class ArcPanel : Panel { protected override void OnPaint(P ...

  8. fido-uaf-protocol-v1.0

    EXAMPLE 1: Policy matching either a FPS-, or Face Recognition-based Authenticator { "accepted&q ...

  9. A. Grasshopper And the String(CF ROUND 378 DIV2)

    A. Grasshopper And the String time limit per test 1 second memory limit per test 256 megabytes input ...

  10. 两种为wangEditor添加拖拽调整高度的方式:CSS3和jQuery UI

    wangEditor是一款优秀的Web富文本编辑器,但如果能像KindEditor那样支持拖拽调整高度就更好了.有两种方式可以为wangEditor添加这一功能,这里使用的wangEditor版本为2 ...