码迷,mamicode.com
首页 > 其他好文 > 详细

【maven】私服搭建

时间:2019-11-30 00:10:16      阅读:72      评论:0      收藏:0      [点我收藏+]

标签:mirror   属性   key   登陆   地址   should   lap   border   number   

转自:https://www.cnblogs.com/likehua/p/4552620.html

一、软件安装

  地址:http://www.sonatype.org/nexus/thank-you-for-downloading/?dl=tgz

  解压:

     技术图片

      启动:

     >> nexus start

  打开:http://192.9.104.17:8081/nexus/#welcome

     技术图片

   点击右上角,使用admin/admin123(默认管理员)登陆。

   管理操作面板(修改代码库、镜像、用户权限管理等):

     技术图片

     

二、系统配置

  默认的nexus 配置的镜像是无法使用的,需要我们把它设置为可行的,重新构建索引。

            技术图片

  重新构建索引:

    技术图片

  需要修改的仓库有三处:Central、Apache Snapshots、Codehaus Snapshots

  另外,releases和snapshots两处的可以自动部署属性必须勾上,如下图:

    技术图片

  当然,你也可以通过界面来上传jar包。

    技术图片

三、maven环境配置

  1、确保你的环境中已经部署和正确配置了maven环境,具体如果安装maven不在此教程范畴之内。

  2、到你当前登录的用户下的.m2目录下,创建一个setting.xml,内容如下:

    

     主要注意修改:servers和mirrors两处,如本例所示:

  servers:

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<servers>
   <!-- server
    | Specifies the authentication information to use when connecting to a particular server, identified by
    | a unique name within the system (referred to by the ‘id‘ attribute below).
    |
    | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
    |       used together.
    |
   <server>
     <id>deploymentRepo</id>
     <username>repouser</username>
     <password>repopwd</password>
   </server>
   -->
    
   <!-- Another sample, using keys to authenticate.
   <server>
     <id>siteServer</id>
     <privateKey>/path/to/private/key</privateKey>
     <passphrase>optional; leave empty if not used.</passphrase>
   </server>
   -->
    <server>
     <id>snapshots</id>
     <username>likehua</username>
     <password>likehua</password>
   </server>
   <server>
     <id>releases</id>
     <username>likehua</username>
     <password>likehua</password>
   </server>
 
   <server>
       <id>tomcat-remote-deploy</id>
       <username>tomcat</username>
       <password>tomcat123</password>
   </server>
 </servers>

   注意此处的用户名和密码,是你nexus上创建的用户名,一般付给部署的权限。

  另外就是镜像地址的配置:

       

技术图片
 1   <mirrors>
 2     <!-- mirror
 3      | Specifies a repository mirror site to use instead of a given repository. The repository that
 4      | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
 5      | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
 6      |
 7     <mirror>
 8       <id>mirrorId</id>
 9       <mirrorOf>repositoryId</mirrorOf>
10       <name>Human Readable Name for this Mirror.</name>
11       <url>http://my.repository.com/repo/path</url>
12     </mirror>
13      -->
14       <mirror>
15         <id>nexus</id>
16         <mirrorOf>*</mirrorOf>
17         <name>A Local Nexus Server</name>
18         <url>http://192.9.104.17:8081/nexus/content/groups/public/</url>
19     </mirror>
20   </mirrors>
技术图片

     ok,maven私服搭建配置完成。

【maven】私服搭建

标签:mirror   属性   key   登陆   地址   should   lap   border   number   

原文地址:https://www.cnblogs.com/wjqhuaxia/p/11960860.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!