乐鱼电竞


教育行业A股IPO第一股(股票代码 003032)

全国咨询/投诉热线:400-618-4000

vaven进阶

更新时间:2018年10月26日16时32分 来源:乐鱼播客 浏览次数:

私服(nexus)
  • 私服的搭建一般由运维人员来做的
安装nexus 和 启动
  • 解压nexus-2.12.0-01-bundle.zip后得到两个文件夹
    • 私服仓库
    • 私服软件: BS结构的,通过浏览器访问
  • 安装:
    • 进入到私服的bin目录下: nexus.bat install
    • 安装成功后本地服务里会多了个nexus服务,默认没有启动
    • 我们通过命令行启动: nexus.bat start
  • 启动失败的解决方法: nexus/nexus-2.12.0-01/bin/jsw/conf/wrapper.conf
    • 把第15行: wrapper.java.command=xxx(jdk安装路径)/bin/java.exe
  • 访问私服:
    • http://localhost:8081/nexus
登录nexu
  • 用户名/密码(默认): admin/admin123
仓库类型
  • Virtual--->虚拟仓库(不起任何作用,以后也用不到)
  • Proxy--->代理仓库
  • Hosted--->宿主仓库---本地仓库
  • Group--->组
需求
  • 把dao放到私服上,然后service从私服上下载
    • 第一步:需要在客户端(部署dao工程的电脑)上配置maven环境,并修改settings.xml文件,配置连接私服的用户和密码
    • 此用户名和密码用于私服校验,因为私服需要知道上传都的账号和密码是否和私服中的账号和密码一致
    • 第二步:配置项目pom.xml,配置私服地址
    • 配置私服仓库的地址,本公司的自己的jar包会上传到私服的宿主仓库,根据工程的版本号决定上传到哪个宿主仓库,如果版本为release则上传到私服的release仓库,如果版本为snapshot则上传到私服的snapshot仓
    • 注意:pom.xml这里<id> 和 settings.xml 配置 <id> 对应
    • 在maven中配置用户信息(settings.xml)
    • 右键-->run as--->maven built...--->deploy
  • 修改后pom.xml版本号要改
[XML] 纯文本查看 复制代码
?
01
02
03
04
05
06
07
08
09
10
<server>
    <id>releases</id>
    <username>admin</username>
    <password>admin123</password>
</server>
<server>
    <id>snapshots</id>
    <username>admin</username>
    <password>admin123</password>
</server>


[XML] 纯文本查看 复制代码
?
01
02
03
04
05
06
07
08
09
10
<distributionManagement>
    <repository>
        <id>releases</id>
        <url>http://localhost:8081/nexus/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>


  • 将ssh_dao的这个工程打成jar包,并放入到私服上去
    • 第一步 修改settings.xml
  • 删除本地仓库中的dao
  • update service工程,出现以下信息说明已经成功

[XML] 纯文本查看 复制代码
?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<profile>  
<!--profile的id-->
<id>dev</id>  
<repositories>  
    <repository
        <!--仓库id,repositories可以配置多个仓库,保证id不重复-->
        <id>nexus</id>  
        <!--仓库地址,即nexus仓库组的地址-->
        <url>http://localhost:8081/nexus/content/groups/public/</url>  
        <!--是否下载releases构件-->
        <releases>  
            <enabled>true</enabled>  
        </releases>  
        <!--是否下载snapshots构件-->
        <snapshots>  
            <enabled>true</enabled>  
        </snapshots>  
    </repository>  
</repositories
<pluginRepositories
    <!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 -->
    <pluginRepository
        <!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 -->
        <id>public</id
        <name>Public Repositories</name
        <url>http://localhost:8081/nexus/content/groups/public/</url
    </pluginRepository
</pluginRepositories
</profile>
<activeProfiles>
    <activeProfile>dev</activeProfile>
</activeProfiles>
作者:乐鱼播客JavaEE培训学院
首发:http://java.itcast.cn/
0 分享到:
和我们在线交谈!
【网站地图】【sitemap】